Skip to content

Commit 1a8a276

Browse files
committed
coll/libnbc: use zero-size messages in ibarrier
and silence a valgrind warning Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 2eec6a0 commit 1a8a276

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

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;

0 commit comments

Comments
 (0)