Skip to content

Commit 196a91e

Browse files
committed
coll/basic: fix neighbor alltoall message ordering
This commit updates the coll/basic component to correctly order sends and receives for cartesian communicators with cyclic boundaries. This addresses an issue identified by mpi-forum/mpi-issues#153. This issue occurs when the size in any dimension is 1. This gives the same neighbor in the positive and negative directions. The old code was sending and receiving in the same order so the -1 buffer contained the +1 result and vise-versa. The problem is addressed by using unique tags for each send. This should cover both the case where overtaking is allowed and is not allowed. The former case will be possible is a MPI_Cart_create_with_info() call is added to the standard. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent ea7e1ea commit 196a91e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Copyright (c) 2014-2015 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* Copyright (c) 2017 IBM Corporation. All rights reserved.
18+
* Copyright (c) 2019 Google, LLC. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -67,7 +68,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_
6768
if (MPI_PROC_NULL != srank) {
6869
nreqs++;
6970
rc = MCA_PML_CALL(irecv(rbuf, rcount, rdtype, srank,
70-
MCA_COLL_BASE_TAG_ALLTOALL,
71+
MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim,
7172
comm, preqs++));
7273
if (OMPI_SUCCESS != rc) break;
7374
}
@@ -77,7 +78,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_
7778
if (MPI_PROC_NULL != drank) {
7879
nreqs++;
7980
rc = MCA_PML_CALL(irecv(rbuf, rcount, rdtype, drank,
80-
MCA_COLL_BASE_TAG_ALLTOALL,
81+
MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim - 1,
8182
comm, preqs++));
8283
if (OMPI_SUCCESS != rc) break;
8384
}
@@ -104,7 +105,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_
104105
* a const for the send buffer. */
105106
nreqs++;
106107
rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, srank,
107-
MCA_COLL_BASE_TAG_ALLTOALL,
108+
MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim - 1,
108109
MCA_PML_BASE_SEND_STANDARD,
109110
comm, preqs++));
110111
if (OMPI_SUCCESS != rc) break;
@@ -115,7 +116,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_
115116
if (MPI_PROC_NULL != drank) {
116117
nreqs++;
117118
rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, drank,
118-
MCA_COLL_BASE_TAG_ALLTOALL,
119+
MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim,
119120
MCA_PML_BASE_SEND_STANDARD,
120121
comm, preqs++));
121122
if (OMPI_SUCCESS != rc) break;

0 commit comments

Comments
 (0)