Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit b9e738c

Browse files
committed
coll/libnbc: fix MPI_Ineighbor_alltoallw when in place.
This is a one off and a quick fix, and it unlikely works with complex types (e.g. negative lower bound). libnbc considers MPI_Ineighbor_alltoallw is in place when send and recv buffers are identical, and even if they do not overlap because of distinct displacements. Thanks Jun Kudo for the bug report.
1 parent dfcf58e commit b9e738c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/*
2-
* Copyright (c) 2006 The Trustees of Indiana University and Indiana
3-
* University Research and Technology
4-
* Corporation. All rights reserved.
5-
* Copyright (c) 2006 The Technical University of Chemnitz. All
6-
* rights reserved.
2+
* Copyright (c) 2006 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2006 The Technical University of Chemnitz. All
6+
* rights reserved.
7+
* Copyright (c) 2016 Research Organization for Information Science
8+
* and Technology (RIST). All rights reserved.
79
*
810
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
911
*
@@ -100,14 +102,15 @@ int ompi_coll_libnbc_ineighbor_alltoallw(void *sbuf, int *scounts, MPI_Aint *sdi
100102
if(res != NBC_OK) return res;
101103

102104
if(inplace) { /* we need an extra buffer to be deadlock-free */
103-
int sumrbytes=0;
105+
MPI_Aint sumrbytes=0, offset=0;
104106
for(i=0; i<indegree; ++i) sumrbytes += rcounts[i]*rcvexts[i];
105107
handle->tmpbuf = malloc(sumrbytes);
106108

107109
for(i = 0; i < indegree; i++) {
108110
if(srcs[i] != MPI_PROC_NULL) {
109-
res = NBC_Sched_recv((char*)0+rdisps[i], true, rcounts[i], rtypes[i], srcs[i], schedule);
111+
res = NBC_Sched_recv((char*)0+offset, true, rcounts[i], rtypes[i], srcs[i], schedule);
110112
if (NBC_OK != res) { printf("Error in NBC_Sched_recv() (%i)\n", res); return res; }
113+
offset += rcounts[i]*rcvexts[i];
111114
}
112115
}
113116
for(i = 0; i < outdegree; i++) {
@@ -117,11 +120,13 @@ int ompi_coll_libnbc_ineighbor_alltoallw(void *sbuf, int *scounts, MPI_Aint *sdi
117120
}
118121
}
119122
/* unpack from buffer */
123+
offset = 0;
120124
for(i = 0; i < indegree; i++) {
121125
res = NBC_Sched_barrier(schedule);
122126
if (NBC_OK != res) { printf("Error in NBC_Sched_barrier() (%i)\n", res); return res; }
123-
res = NBC_Sched_copy((char*)0+rdisps[i], true, rcounts[i], rtypes[i], (char*)rbuf+rdisps[i], false, rcounts[i], rtypes[i], schedule);
127+
res = NBC_Sched_copy((char*)0+offset, true, rcounts[i], rtypes[i], (char*)rbuf+rdisps[i], false, rcounts[i], rtypes[i], schedule);
124128
if (NBC_OK != res) { printf("Error in NBC_Sched_copy() (%i)\n", res); return res; }
129+
offset += rcounts[i] * rcvexts[i];
125130
}
126131
} else { /* non INPLACE case */
127132
/* simply loop over neighbors and post send/recv operations */

0 commit comments

Comments
 (0)