Skip to content

Commit 1294954

Browse files
committed
coll/libnbc: fix a2aw_sched_linear() with zero size datatype or zero count
Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent bf0fc4a commit 1294954

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ompi/mca/coll/libnbc/nbc_ialltoallw.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,23 @@ static inline int a2aw_sched_linear(int rank, int p, NBC_Schedule *schedule,
193193
int res;
194194

195195
for (int i = 0; i < p; i++) {
196+
ptrdiff_t gap, span;
196197
if (i == rank) {
197198
continue;
198199
}
199200

200201
/* post send */
201-
if (sendcounts[i] != 0) {
202+
span = opal_datatype_span(&sendtypes[i]->super, sendcounts[i], &gap);
203+
if (OPAL_LIKELY(0 < span)) {
202204
char *sbuf = (char *) sendbuf + sdispls[i];
203205
res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtypes[i], i, schedule, false);
204206
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
205207
return res;
206208
}
207209
}
208210
/* post receive */
209-
if (recvcounts[i] != 0) {
211+
span = opal_datatype_span(&recvtypes[i]->super, recvcounts[i], &gap);
212+
if (OPAL_LIKELY(0 < span)) {
210213
char *rbuf = (char *) recvbuf + rdispls[i];
211214
res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtypes[i], i, schedule, false);
212215
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {

0 commit comments

Comments
 (0)