diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c index 9ab3781c9826800835f31d5c490e97093fffc3f3..242a69c6037ae118b4b8da5bc80605c47e57b99e 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c @@ -87,7 +87,7 @@ static int nbc_neighbor_alltoall_init(const void *sbuf, int scount, MPI_Datatype return res; } - for (int i = 0 ; i < indegree ; ++i) { + for (int i = indegree - 1 ; i >= 0 ; --i) { if (MPI_PROC_NULL != srcs[i]) { res = NBC_Sched_recv ((char *) rbuf + (MPI_Aint) rcvext * i * rcount, true, rcount, rtype, srcs[i], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c index 054b047cb8ec7b8340fc578721cf74f7e358cb7d..8dd3909453658d451cd59c732c89ec125e605b3a 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c @@ -91,7 +91,7 @@ static int nbc_neighbor_alltoallv_init(const void *sbuf, const int *scounts, con } /* simply loop over neighbors and post send/recv operations */ - for (int i = 0 ; i < indegree ; ++i) { + for (int i = indegree - 1 ; i >= 0 ; --i) { if (srcs[i] != MPI_PROC_NULL) { res = NBC_Sched_recv ((char *) rbuf + rdispls[i] * rcvext, false, rcounts[i], rtype, srcs[i], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c index 270a0b20b34a0b90e44c1159dceb6ceb9e7476c8..554830bda6bfe19c1744c1daf306284240a46a2c 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c @@ -77,7 +77,7 @@ static int nbc_neighbor_alltoallw_init(const void *sbuf, const int *scounts, con } /* simply loop over neighbors and post send/recv operations */ - for (int i = 0 ; i < indegree ; ++i) { + for (int i = indegree - 1 ; i >= 0 ; --i) { if (srcs[i] != MPI_PROC_NULL) { res = NBC_Sched_recv ((char *) rbuf + rdisps[i], false, rcounts[i], rtypes[i], srcs[i], schedule, false); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {