coll/libnbc: fix the red_schain algo of ireduce with MPI_IN_PLACE
this fixes a regression introduced in open-mpi/ompi@045d0c5f4c Fixes open-mpi/ompi#2879 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
родитель
b12ab2b4f2
Коммит
9bcadbd51b
@ -427,39 +427,24 @@ static inline int red_sched_chain (int rank, int p, int root, const void *sendbu
|
||||
|
||||
/* last node does not recv */
|
||||
if (vrank != p-1) {
|
||||
if (vrank == 0) {
|
||||
if (sendbuf != recvbuf) {
|
||||
// for regular src, recv into recvbuf
|
||||
if (vrank == 0 && sendbuf != recvbuf) {
|
||||
res = NBC_Sched_recv ((char *)recvbuf+offset, false, thiscount, datatype, rpeer, schedule, true);
|
||||
} else {
|
||||
// but for any-src, recv into tmpbuf
|
||||
// because for MPI_IN_PLACE if we recved into recvbuf here we'd be
|
||||
// overwriting our sendbuf, and we use it in the operation
|
||||
// that happens further down
|
||||
res = NBC_Sched_recv ((char *)offset, true, thiscount, datatype, rpeer, schedule, true);
|
||||
}
|
||||
} else {
|
||||
if (sendbuf != recvbuf) {
|
||||
// for regular src, add sendbuf into recvbuf
|
||||
// (here recvbuf holds the reduction from 1..n-1)
|
||||
res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) recvbuf + offset, false,
|
||||
thiscount, datatype, op, schedule, true);
|
||||
} else {
|
||||
// for MPI_IN_PLACE, add tmpbuf into recvbuf
|
||||
// (here tmpbuf holds the reduction from 1..n-1) and
|
||||
// recvbuf is our sendbuf
|
||||
res = NBC_Sched_op ((char *) offset, true, (char *) recvbuf + offset, false,
|
||||
thiscount, datatype, op, schedule, true);
|
||||
}
|
||||
}
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
/* root reduces into receivebuf */
|
||||
if(vrank == 0) {
|
||||
res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) recvbuf + offset, false,
|
||||
thiscount, datatype, op, schedule, true);
|
||||
if (sendbuf != recvbuf) {
|
||||
res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) recvbuf + offset, false,
|
||||
thiscount, datatype, op, schedule, true);
|
||||
} else {
|
||||
res = NBC_Sched_op ((char *)offset, true, (char *) recvbuf + offset, false,
|
||||
thiscount, datatype, op, schedule, true);
|
||||
}
|
||||
} else {
|
||||
res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) offset, true, thiscount,
|
||||
datatype, op, schedule, true);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user