Skip to content

Commit fe4c4e9

Browse files
committed
coll/libnbc: fix MPI_IN_PLACE handling in i{gather,scatter}[v]
MPI_IN_PLACE is only relevant on the root task, so only test is there Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 1a8a276 commit fe4c4e9

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

ompi/mca/coll/libnbc/nbc_igather.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Copyright (c) 2013 The University of Tennessee and The University
99
* of Tennessee Research Foundation. All rights
1010
* reserved.
11-
* Copyright (c) 2014-2015 Research Organization for Information Science
11+
* Copyright (c) 2014-2016 Research Organization for Information Science
1212
* and Technology (RIST). All rights reserved.
1313
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1414
* reserved.
@@ -46,13 +46,14 @@ int ompi_coll_libnbc_igather(const void* sendbuf, int sendcount, MPI_Datatype se
4646
int rank, p, res;
4747
MPI_Aint rcvext = 0;
4848
NBC_Schedule *schedule;
49-
char *rbuf, inplace;
49+
char *rbuf, inplace = 0;
5050
NBC_Handle *handle;
5151
ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module;
5252

53-
NBC_IN_PLACE(sendbuf, recvbuf, inplace);
54-
5553
rank = ompi_comm_rank (comm);
54+
if (root == rank) {
55+
NBC_IN_PLACE(sendbuf, recvbuf, inplace);
56+
}
5657
p = ompi_comm_size (comm);
5758

5859
if (rank == root) {

ompi/mca/coll/libnbc/nbc_igatherv.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Copyright (c) 2013 The University of Tennessee and The University
99
* of Tennessee Research Foundation. All rights
1010
* reserved.
11-
* Copyright (c) 2014-2015 Research Organization for Information Science
11+
* Copyright (c) 2014-2016 Research Organization for Information Science
1212
* and Technology (RIST). All rights reserved.
1313
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1414
* reserved.
@@ -31,13 +31,14 @@ int ompi_coll_libnbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype s
3131
int rank, p, res;
3232
MPI_Aint rcvext = 0;
3333
NBC_Schedule *schedule;
34-
char *rbuf, inplace;
34+
char *rbuf, inplace = 0;
3535
NBC_Handle *handle;
3636
ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module;
3737

38-
NBC_IN_PLACE(sendbuf, recvbuf, inplace);
39-
4038
rank = ompi_comm_rank (comm);
39+
if (root == rank) {
40+
NBC_IN_PLACE(sendbuf, recvbuf, inplace);
41+
}
4142
p = ompi_comm_size (comm);
4243

4344
if (rank == root) {

ompi/mca/coll/libnbc/nbc_iscatter.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2013 The University of Tennessee and The University
1111
* of Tennessee Research Foundation. All rights
1212
* reserved.
13-
* Copyright (c) 2014-2015 Research Organization for Information Science
13+
* Copyright (c) 2014-2016 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
*
1616
* Author(s): Torsten Hoefler <[email protected]>
@@ -47,13 +47,15 @@ int ompi_coll_libnbc_iscatter (const void* sendbuf, int sendcount, MPI_Datatype
4747
int rank, p, res;
4848
MPI_Aint sndext = 0;
4949
NBC_Schedule *schedule;
50-
char *sbuf, inplace;
50+
char *sbuf, inplace = 0;
5151
NBC_Handle *handle;
5252
ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module;
5353

54-
NBC_IN_PLACE(sendbuf, recvbuf, inplace);
5554

5655
rank = ompi_comm_rank (comm);
56+
if (root == rank) {
57+
NBC_IN_PLACE(sendbuf, recvbuf, inplace);
58+
}
5759
p = ompi_comm_size (comm);
5860

5961
if (rank == root) {

ompi/mca/coll/libnbc/nbc_iscatterv.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2013 The University of Tennessee and The University
1111
* of Tennessee Research Foundation. All rights
1212
* reserved.
13-
* Copyright (c) 2014-2015 Research Organization for Information Science
13+
* Copyright (c) 2014-2016 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
*
1616
* Author(s): Torsten Hoefler <[email protected]>
@@ -30,13 +30,15 @@ int ompi_coll_libnbc_iscatterv(const void* sendbuf, const int *sendcounts, const
3030
int rank, p, res;
3131
MPI_Aint sndext;
3232
NBC_Schedule *schedule;
33-
char *sbuf, inplace;
33+
char *sbuf, inplace = 0;
3434
NBC_Handle *handle;
3535
ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module;
3636

37-
NBC_IN_PLACE(sendbuf, recvbuf, inplace);
38-
3937
rank = ompi_comm_rank (comm);
38+
if (root == rank) {
39+
NBC_IN_PLACE(sendbuf, recvbuf, inplace);
40+
}
41+
4042
p = ompi_comm_size (comm);
4143

4244
schedule = OBJ_NEW(NBC_Schedule);

0 commit comments

Comments
 (0)