|
7 | 7 | * rights reserved. |
8 | 8 | * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights |
9 | 9 | * reserved. |
10 | | - * Copyright (c) 2014-2016 Research Organization for Information Science |
| 10 | + * Copyright (c) 2014-2017 Research Organization for Information Science |
11 | 11 | * and Technology (RIST). All rights reserved. |
12 | | - * Copyright (c) 2017 IBM Corporation. All rights reserved. |
13 | 12 | * |
14 | 13 | * Author(s): Torsten Hoefler <[email protected]> |
15 | 14 | * |
@@ -426,39 +425,24 @@ static inline int red_sched_chain (int rank, int p, int root, const void *sendbu |
426 | 425 |
|
427 | 426 | /* last node does not recv */ |
428 | 427 | if (vrank != p-1) { |
429 | | - if (vrank == 0) { |
430 | | - if (sendbuf != recvbuf) { |
431 | | - // for regular src, recv into recvbuf |
432 | | - res = NBC_Sched_recv ((char *)recvbuf+offset, false, thiscount, datatype, rpeer, schedule, true); |
433 | | - } else { |
434 | | - // but for any-src, recv into tmpbuf |
435 | | - // because for MPI_IN_PLACE if we recved into recvbuf here we'd be |
436 | | - // overwriting our sendbuf, and we use it in the operation |
437 | | - // that happens further down |
438 | | - res = NBC_Sched_recv ((char *)offset, true, thiscount, datatype, rpeer, schedule, true); |
439 | | - } |
| 428 | + if (vrank == 0 && sendbuf != recvbuf) { |
| 429 | + res = NBC_Sched_recv ((char *)recvbuf+offset, false, thiscount, datatype, rpeer, schedule, true); |
440 | 430 | } else { |
441 | | - if (sendbuf != recvbuf) { |
442 | | - // for regular src, add sendbuf into recvbuf |
443 | | - // (here recvbuf holds the reduction from 1..n-1) |
444 | | - res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) recvbuf + offset, false, |
445 | | - thiscount, datatype, op, schedule, true); |
446 | | - } else { |
447 | | - // for MPI_IN_PLACE, add tmpbuf into recvbuf |
448 | | - // (here tmpbuf holds the reduction from 1..n-1) and |
449 | | - // recvbuf is our sendbuf |
450 | | - res = NBC_Sched_op ((char *) offset, true, (char *) recvbuf + offset, false, |
451 | | - thiscount, datatype, op, schedule, true); |
452 | | - } |
| 431 | + res = NBC_Sched_recv ((char *)offset, true, thiscount, datatype, rpeer, schedule, true); |
453 | 432 | } |
454 | 433 | if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { |
455 | 434 | return res; |
456 | 435 | } |
457 | 436 |
|
458 | 437 | /* root reduces into receivebuf */ |
459 | 438 | if(vrank == 0) { |
460 | | - res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) recvbuf + offset, false, |
461 | | - 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 | + } |
462 | 446 | } else { |
463 | 447 | res = NBC_Sched_op ((char *) sendbuf + offset, false, (char *) offset, true, thiscount, |
464 | 448 | datatype, op, schedule, true); |
|
0 commit comments