Skip to content

Commit d8c50a5

Browse files
committed
Fix disp. calculation in IN_PLACE alltoallv
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>
1 parent f32dc49 commit d8c50a5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ompi/mca/coll/base/coll_base_alltoallv.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
5454
mca_coll_base_module_t *module)
5555
{
5656
int i, size, rank, left, right, err = MPI_SUCCESS, line;
57+
ptrdiff_t extent;
5758
ompi_request_t *req;
5859
char *tmp_buffer;
5960
size_t packed_size = 0, max_size;
@@ -89,6 +90,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
8990
}
9091
#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT */
9192

93+
ompi_datatype_type_extent(rdtype, &extent);
94+
9295
/* Allocate a temporary buffer */
9396
tmp_buffer = calloc (max_size, 1);
9497
if( NULL == tmp_buffer) { err = OMPI_ERR_OUT_OF_RESOURCE; line = __LINE__; goto error_hndl; }
@@ -104,20 +107,20 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
104107
ompi_proc_t *right_proc = ompi_comm_peer_lookup(comm, right);
105108
opal_convertor_clone(right_proc->super.proc_convertor, &convertor, 0);
106109
opal_convertor_prepare_for_send(&convertor, &rdtype->super, rcounts[right],
107-
(char *) rbuf + rdisps[right]);
110+
(char *) rbuf + rdisps[right] * extent);
108111
packed_size = max_size;
109112
err = opal_convertor_pack(&convertor, &iov, &iov_count, &packed_size);
110113
if (1 != err) { goto error_hndl; }
111114

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

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

128131
/* Receive data from the left */
129-
err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[left], rcounts[left], rdtype,
132+
err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[left] * extent, rcounts[left], rdtype,
130133
left, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &req));
131134
if (MPI_SUCCESS != err) { goto error_hndl; }
132135
}

0 commit comments

Comments
 (0)