Skip to content

Commit c1a98f1

Browse files
committed
coll/base: do not send and receive 0 byte message for linear alltoallv
Prior to this change, the linear algorithm of alltoallv will post send and receive even when sendcount and recvcount is 0. This patch make the algorithm to skip 0 byte send/receive. This patch works because MPI standard has strict requirement on collective message size. According to MPI standard's Collectives Introduction and Overview (6.1) section: For collective operations, the amount of data sent must exactly match the amount of data specified by the receiver. Signed-off-by: Wei Zhang <wzam@amazon.com>
1 parent 271cced commit c1a98f1

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

ompi/mca/coll/base/coll_base_alltoallv.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,14 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts
310310
continue;
311311
}
312312

313-
++nreqs;
314-
prcv = ((char *) rbuf) + (ptrdiff_t)rdisps[i] * rext;
315-
err = MCA_PML_CALL(irecv_init(prcv, rcounts[i], rdtype,
316-
i, MCA_COLL_BASE_TAG_ALLTOALLV, comm,
317-
preq++));
318-
if (MPI_SUCCESS != err) { goto err_hndl; }
313+
if (rcounts[i] > 0) {
314+
++nreqs;
315+
prcv = ((char *) rbuf) + (ptrdiff_t)rdisps[i] * rext;
316+
err = MCA_PML_CALL(irecv_init(prcv, rcounts[i], rdtype,
317+
i, MCA_COLL_BASE_TAG_ALLTOALLV, comm,
318+
preq++));
319+
if (MPI_SUCCESS != err) { goto err_hndl; }
320+
}
319321
}
320322

321323
/* Now post all sends */
@@ -324,13 +326,15 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts
324326
continue;
325327
}
326328

327-
++nreqs;
328-
psnd = ((char *) sbuf) + (ptrdiff_t)sdisps[i] * sext;
329-
err = MCA_PML_CALL(isend_init(psnd, scounts[i], sdtype,
330-
i, MCA_COLL_BASE_TAG_ALLTOALLV,
331-
MCA_PML_BASE_SEND_STANDARD, comm,
332-
preq++));
333-
if (MPI_SUCCESS != err) { goto err_hndl; }
329+
if (scounts[i] > 0) {
330+
++nreqs;
331+
psnd = ((char *) sbuf) + (ptrdiff_t)sdisps[i] * sext;
332+
err = MCA_PML_CALL(isend_init(psnd, scounts[i], sdtype,
333+
i, MCA_COLL_BASE_TAG_ALLTOALLV,
334+
MCA_PML_BASE_SEND_STANDARD, comm,
335+
preq++));
336+
if (MPI_SUCCESS != err) { goto err_hndl; }
337+
}
334338
}
335339

336340
/* Start your engines. This will never return an error. */

0 commit comments

Comments
 (0)