Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ompi/mca/coll/base/coll_base_scatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,14 @@ ompi_coll_base_scatter_intra_binomial(
scount = (int)packed_sizet;

sdtype = MPI_PACKED; /* default to MPI_PACKED as the send type */
packed_size = scount * (size+1)/2; /* non-root, non-leaf nodes, allocate temp buffer for recv
* the most we need is rcount*size/2 */

/* non-root, non-leaf nodes, allocate temp buffer for recv the most we need is rcount*size/2 (an upper bound) */
int vparent = (bmtree->tree_prev - root + size) % size;
int subtree_size = vrank - vparent;
if (size - vrank < subtree_size)
subtree_size = size - vrank;
packed_size = scount * subtree_size;

ptmp = tempbuf = (char *)malloc(packed_size);
if (NULL == tempbuf) {
err = OMPI_ERR_OUT_OF_RESOURCE; line = __LINE__; goto err_hndl;
Expand Down