Skip to content

Commit

Permalink
Fix disp. calculation in IN_PLACE alltoallv
Browse files Browse the repository at this point in the history
b9012a3 used the alltoallw interpretation of rdisps instead of the
alltoall/alltoallv interpretation.  According to the MPI standard,
the byte displacement is recvbuf + rdispls[i] * extent(recvtype) for
alltoall and alltoallv, but is recvbuf + rdispls[i] for alltoallw.

Signed-off-by: Brian Barrett <bbarrett@amazon.com>
  • Loading branch information
bwbarrett committed Nov 16, 2021
1 parent f32dc49 commit d8c50a5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ompi/mca/coll/base/coll_base_alltoallv.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
mca_coll_base_module_t *module)
{
int i, size, rank, left, right, err = MPI_SUCCESS, line;
ptrdiff_t extent;
ompi_request_t *req;
char *tmp_buffer;
size_t packed_size = 0, max_size;
Expand Down Expand Up @@ -89,6 +90,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
}
#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT */

ompi_datatype_type_extent(rdtype, &extent);

/* Allocate a temporary buffer */
tmp_buffer = calloc (max_size, 1);
if( NULL == tmp_buffer) { err = OMPI_ERR_OUT_OF_RESOURCE; line = __LINE__; goto error_hndl; }
Expand All @@ -104,20 +107,20 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
ompi_proc_t *right_proc = ompi_comm_peer_lookup(comm, right);
opal_convertor_clone(right_proc->super.proc_convertor, &convertor, 0);
opal_convertor_prepare_for_send(&convertor, &rdtype->super, rcounts[right],
(char *) rbuf + rdisps[right]);
(char *) rbuf + rdisps[right] * extent);
packed_size = max_size;
err = opal_convertor_pack(&convertor, &iov, &iov_count, &packed_size);
if (1 != err) { goto error_hndl; }

/* Receive data from the right */
err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[right], rcounts[right], rdtype,
err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[right] * extent, rcounts[right], rdtype,
right, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &req));
if (MPI_SUCCESS != err) { goto error_hndl; }
}

if( (left != right) && (0 != rcounts[left]) ) {
/* Send data to the left */
err = MCA_PML_CALL(send ((char *) rbuf + rdisps[left], rcounts[left], rdtype,
err = MCA_PML_CALL(send ((char *) rbuf + rdisps[left] * extent, rcounts[left], rdtype,
left, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD,
comm));
if (MPI_SUCCESS != err) { goto error_hndl; }
Expand All @@ -126,7 +129,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
if (MPI_SUCCESS != err) { goto error_hndl; }

/* Receive data from the left */
err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[left], rcounts[left], rdtype,
err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[left] * extent, rcounts[left], rdtype,
left, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &req));
if (MPI_SUCCESS != err) { goto error_hndl; }
}
Expand Down

0 comments on commit d8c50a5

Please sign in to comment.