Skip to content

Commit 6802702

Browse files
bosilcabwbarrett
authored andcommitted
Always wait to complete all receives.
Without waiting for the last receive before going to the next iteration we might overwrite data if the current left neighbor become the right at the next iteration. Start with an MPI_REQUEST_NULL request. If the request is not NULL and the first rcounts is 0, the ompi_request_wait will segfault. Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
1 parent d8c50a5 commit 6802702

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ompi/mca/coll/base/coll_base_alltoallv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
5555
{
5656
int i, size, rank, left, right, err = MPI_SUCCESS, line;
5757
ptrdiff_t extent;
58-
ompi_request_t *req;
58+
ompi_request_t *req = MPI_REQUEST_NULL;
5959
char *tmp_buffer;
6060
size_t packed_size = 0, max_size;
6161
opal_convertor_t convertor;
@@ -140,10 +140,10 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
140140
right, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD,
141141
comm));
142142
if (MPI_SUCCESS != err) { goto error_hndl; }
143-
144-
err = ompi_request_wait (&req, MPI_STATUSES_IGNORE);
145-
if (MPI_SUCCESS != err) { goto error_hndl; }
146143
}
144+
145+
err = ompi_request_wait (&req, MPI_STATUSES_IGNORE);
146+
if (MPI_SUCCESS != err) { goto error_hndl; }
147147
}
148148

149149
error_hndl:

ompi/mca/coll/basic/coll_basic_alltoallw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con
139139
right, MCA_COLL_BASE_TAG_ALLTOALLW, MCA_PML_BASE_SEND_STANDARD,
140140
comm));
141141
if (MPI_SUCCESS != err) { goto error_hndl; }
142-
143-
err = ompi_request_wait (&req, MPI_STATUSES_IGNORE);
144-
if (MPI_SUCCESS != err) { goto error_hndl; }
145142
}
143+
144+
err = ompi_request_wait (&req, MPI_STATUSES_IGNORE);
145+
if (MPI_SUCCESS != err) { goto error_hndl; }
146146
}
147147

148148
error_hndl:

0 commit comments

Comments
 (0)