From 6802702a11cb2048bc59f93d6ec5c217e1ce5882 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Tue, 16 Nov 2021 02:42:33 -0500 Subject: [PATCH] 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 --- ompi/mca/coll/base/coll_base_alltoallv.c | 8 ++++---- ompi/mca/coll/basic/coll_basic_alltoallw.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_alltoallv.c b/ompi/mca/coll/base/coll_base_alltoallv.c index c3c22cb564d..62289036be6 100644 --- a/ompi/mca/coll/base/coll_base_alltoallv.c +++ b/ompi/mca/coll/base/coll_base_alltoallv.c @@ -55,7 +55,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts { int i, size, rank, left, right, err = MPI_SUCCESS, line; ptrdiff_t extent; - ompi_request_t *req; + ompi_request_t *req = MPI_REQUEST_NULL; char *tmp_buffer; size_t packed_size = 0, max_size; opal_convertor_t convertor; @@ -140,10 +140,10 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts right, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != err) { goto error_hndl; } - - err = ompi_request_wait (&req, MPI_STATUSES_IGNORE); - if (MPI_SUCCESS != err) { goto error_hndl; } } + + err = ompi_request_wait (&req, MPI_STATUSES_IGNORE); + if (MPI_SUCCESS != err) { goto error_hndl; } } error_hndl: diff --git a/ompi/mca/coll/basic/coll_basic_alltoallw.c b/ompi/mca/coll/basic/coll_basic_alltoallw.c index 50ec9c9774b..0f8a2dae144 100644 --- a/ompi/mca/coll/basic/coll_basic_alltoallw.c +++ b/ompi/mca/coll/basic/coll_basic_alltoallw.c @@ -139,10 +139,10 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con right, MCA_COLL_BASE_TAG_ALLTOALLW, MCA_PML_BASE_SEND_STANDARD, comm)); if (MPI_SUCCESS != err) { goto error_hndl; } - - err = ompi_request_wait (&req, MPI_STATUSES_IGNORE); - if (MPI_SUCCESS != err) { goto error_hndl; } } + + err = ompi_request_wait (&req, MPI_STATUSES_IGNORE); + if (MPI_SUCCESS != err) { goto error_hndl; } } error_hndl: