Skip to content

Commit 135a8f6

Browse files
authored
Merge pull request #2494 from ggouaillardet/topic/v2.0.x/misc_coll_fixes
v2.0.x: misc coll fixes
2 parents b124a71 + e04cb5a commit 135a8f6

File tree

9 files changed

+41
-44
lines changed

9 files changed

+41
-44
lines changed

ompi/mca/coll/base/coll_base_reduce.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ int ompi_coll_base_reduce_generic( const void* sendbuf, void* recvbuf, int origi
9999

100100
/* If this is a non-commutative operation we must copy
101101
sendbuf to the accumbuf, in order to simplfy the loops */
102-
if (!ompi_op_is_commute(op)) {
102+
103+
if (!ompi_op_is_commute(op) && MPI_IN_PLACE != sendbuf) {
103104
ompi_datatype_copy_content_same_ddt(datatype, original_count,
104105
(char*)accumbuf,
105106
(char*)sendtmpbuf);

ompi/mca/coll/base/coll_base_reduce_scatter.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2009 University of Houston. All rights reserved.
1515
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
1616
* reserved.
17-
* Copyright (c) 2015 Research Organization for Information Science
17+
* Copyright (c) 2015-2016 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* $COPYRIGHT$
2020
*
@@ -95,9 +95,15 @@ int ompi_coll_base_reduce_scatter_intra_nonoverlapping(const void *sbuf, void *r
9595
for (i = 1; i < size; i++) {
9696
displs[i] = displs[i-1] + rcounts[i-1];
9797
}
98-
err = comm->c_coll.coll_scatterv (tmprbuf, rcounts, displs, dtype,
99-
rbuf, rcounts[rank], dtype,
100-
root, comm, comm->c_coll.coll_scatterv_module);
98+
if (MPI_IN_PLACE == sbuf && root == rank) {
99+
err = comm->c_coll.coll_scatterv (tmprbuf, rcounts, displs, dtype,
100+
MPI_IN_PLACE, 0, MPI_DATATYPE_NULL,
101+
root, comm, comm->c_coll.coll_scatterv_module);
102+
} else {
103+
err = comm->c_coll.coll_scatterv (tmprbuf, rcounts, displs, dtype,
104+
rbuf, rcounts[rank], dtype,
105+
root, comm, comm->c_coll.coll_scatterv_module);
106+
}
101107
free(displs);
102108
if (NULL != tmprbuf_free) free(tmprbuf_free);
103109

ompi/mca/coll/libnbc/nbc_ibarrier.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ int ompi_coll_libnbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t *
3333
return res;
3434
}
3535

36-
handle->tmpbuf = malloc (2);
37-
if (OPAL_UNLIKELY(NULL == handle->tmpbuf)) {
38-
NBC_Return_handle (handle);
39-
return OMPI_ERR_OUT_OF_RESOURCE;
40-
}
41-
4236
#ifdef NBC_CACHE_SCHEDULE
4337
/* there only one argument set per communicator -> hang it directly at
4438
* the tree-position, NBC_Dict_size[...] is 0 for not initialized and
@@ -64,14 +58,14 @@ int ompi_coll_libnbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t *
6458
recvpeer = ((rank - (1 << round)) + p) % p;
6559

6660
/* send msg to sendpeer */
67-
res = NBC_Sched_send ((void *) 0, true, 1, MPI_BYTE, sendpeer, schedule, false);
61+
res = NBC_Sched_send (NULL, false, 0, MPI_BYTE, sendpeer, schedule, false);
6862
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
6963
NBC_Return_handle (handle);
7064
return OMPI_ERR_OUT_OF_RESOURCE;
7165
}
7266

7367
/* recv msg from recvpeer */
74-
res = NBC_Sched_recv ((void *) 1, true, 1, MPI_BYTE, recvpeer, schedule, false);
68+
res = NBC_Sched_recv (NULL, false, 0, MPI_BYTE, recvpeer, schedule, false);
7569
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
7670
NBC_Return_handle (handle);
7771
return OMPI_ERR_OUT_OF_RESOURCE;
@@ -131,12 +125,6 @@ int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_reque
131125
return res;
132126
}
133127

134-
handle->tmpbuf = malloc (2);
135-
if (OPAL_UNLIKELY(NULL == handle->tmpbuf)) {
136-
NBC_Return_handle (handle);
137-
return OMPI_ERR_OUT_OF_RESOURCE;
138-
}
139-
140128
schedule = OBJ_NEW(NBC_Schedule);
141129
if (OPAL_UNLIKELY(NULL == schedule)) {
142130
NBC_Return_handle (handle);
@@ -148,7 +136,7 @@ int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_reque
148136

149137
if (0 == rank) {
150138
for (int peer = 1 ; peer < rsize ; ++peer) {
151-
res = NBC_Sched_recv (0, true, 1, MPI_BYTE, peer, schedule, false);
139+
res = NBC_Sched_recv (NULL, false, 0, MPI_BYTE, peer, schedule, false);
152140
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
153141
NBC_Return_handle (handle);
154142
return OMPI_ERR_OUT_OF_RESOURCE;
@@ -157,13 +145,13 @@ int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_reque
157145
}
158146

159147
/* synchronize with the remote root */
160-
res = NBC_Sched_recv (0, true, 1, MPI_BYTE, 0, schedule, false);
148+
res = NBC_Sched_recv (NULL, false, 0, MPI_BYTE, 0, schedule, false);
161149
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
162150
NBC_Return_handle (handle);
163151
return OMPI_ERR_OUT_OF_RESOURCE;
164152
}
165153

166-
res = NBC_Sched_send (0, true, 1, MPI_BYTE, 0, schedule, false);
154+
res = NBC_Sched_send (NULL, false, 0, MPI_BYTE, 0, schedule, false);
167155
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
168156
NBC_Return_handle (handle);
169157
return OMPI_ERR_OUT_OF_RESOURCE;
@@ -179,7 +167,7 @@ int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_reque
179167

180168
/* inform remote peers that all local peers have entered the barrier */
181169
for (int peer = 1; peer < rsize ; ++peer) {
182-
res = NBC_Sched_send (0, true, 1, MPI_BYTE, peer, schedule, false);
170+
res = NBC_Sched_send (NULL, false, 0, MPI_BYTE, peer, schedule, false);
183171
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
184172
NBC_Return_handle (handle);
185173
return OMPI_ERR_OUT_OF_RESOURCE;

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 s
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);

ompi/mpi/c/gatherv.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
1515
* reserved.
16-
* Copyright (c) 2015 Research Organization for Information Science
16+
* Copyright (c) 2015-2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -48,11 +48,9 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
4848
int i, size, err;
4949

5050
MEMCHECKER(
51-
int rank;
5251
ptrdiff_t ext;
5352

5453
size = ompi_comm_remote_size(comm);
55-
rank = ompi_comm_rank(comm);
5654
ompi_datatype_type_extent(recvtype, &ext);
5755

5856
memchecker_comm(comm);

ompi/mpi/c/igatherv.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
1515
* reserved.
16-
* Copyright (c) 2015 Research Organization for Information Science
16+
* Copyright (c) 2015-2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -48,11 +48,9 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
4848
int i, size, err;
4949

5050
MEMCHECKER(
51-
int rank;
5251
ptrdiff_t ext;
5352

5453
size = ompi_comm_remote_size(comm);
55-
rank = ompi_comm_rank(comm);
5654
ompi_datatype_type_extent(recvtype, &ext);
5755

5856
memchecker_comm(comm);

0 commit comments

Comments
 (0)