Skip to content

Commit

Permalink
coll/libnbc: fix a2aw_sched_linear() with zero size datatype or zero …
Browse files Browse the repository at this point in the history
…count

Signed-off-by: Gilles Gouaillardet <[email protected]>
  • Loading branch information
ggouaillardet committed Feb 13, 2017
1 parent bf0fc4a commit 1294954
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ompi/mca/coll/libnbc/nbc_ialltoallw.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,23 @@ static inline int a2aw_sched_linear(int rank, int p, NBC_Schedule *schedule,
int res;

for (int i = 0; i < p; i++) {
ptrdiff_t gap, span;
if (i == rank) {
continue;
}

/* post send */
if (sendcounts[i] != 0) {
span = opal_datatype_span(&sendtypes[i]->super, sendcounts[i], &gap);
if (OPAL_LIKELY(0 < span)) {
char *sbuf = (char *) sendbuf + sdispls[i];
res = NBC_Sched_send (sbuf, false, sendcounts[i], sendtypes[i], i, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return res;
}
}
/* post receive */
if (recvcounts[i] != 0) {
span = opal_datatype_span(&recvtypes[i]->super, recvcounts[i], &gap);
if (OPAL_LIKELY(0 < span)) {
char *rbuf = (char *) recvbuf + rdispls[i];
res = NBC_Sched_recv (rbuf, false, recvcounts[i], recvtypes[i], i, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
Expand Down

0 comments on commit 1294954

Please sign in to comment.