Skip to content

Commit 353870a

Browse files
authored
Merge pull request #2882 from ggouaillardet/topic/v2.x/red_sched_chain
coll/libnbc: fix the red_schain algo of ireduce with MPI_IN_PLACE
2 parents 60b958c + f22a52b commit 353870a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

ompi/mca/coll/libnbc/nbc_ireduce.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* rights reserved.
88
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
99
* reserved.
10-
* Copyright (c) 2014-2016 Research Organization for Information Science
10+
* Copyright (c) 2014-2017 Research Organization for Information Science
1111
* and Technology (RIST). All rights reserved.
1212
*
1313
* Author(s): Torsten Hoefler <[email protected]>
@@ -425,19 +425,24 @@ static inline int red_sched_chain (int rank, int p, int root, const void *sendbu
425425

426426
/* last node does not recv */
427427
if (vrank != p-1) {
428-
if (vrank == 0) {
428+
if (vrank == 0 && sendbuf != recvbuf) {
429429
res = NBC_Sched_recv ((char *)recvbuf+offset, false, thiscount, datatype, rpeer, schedule, true);
430430
} else {
431-
res = NBC_Sched_recv ((char *) offset, true, thiscount, datatype, rpeer, schedule, true);
431+
res = NBC_Sched_recv ((char *)offset, true, thiscount, datatype, rpeer, schedule, true);
432432
}
433433
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
434434
return res;
435435
}
436436

437437
/* root reduces into receivebuf */
438438
if(vrank == 0) {
439-
res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) recvbuf + offset, false,
440-
thiscount, datatype, op, schedule, true);
439+
if (sendbuf != recvbuf) {
440+
res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) recvbuf + offset, false,
441+
thiscount, datatype, op, schedule, true);
442+
} else {
443+
res = NBC_Sched_op ((char *)offset, true, (char *) recvbuf + offset, false,
444+
thiscount, datatype, op, schedule, true);
445+
}
441446
} else {
442447
res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) offset, true, thiscount,
443448
datatype, op, schedule, true);

0 commit comments

Comments
 (0)