Skip to content

Commit f3581c8

Browse files
committed
coll/base: have alltoallv send/recv zero-bytes messages
Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 5492edd commit f3581c8

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

ompi/mca/coll/base/coll_base_alltoallv.c

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
1515
* reserved.
1616
* Copyright (c) 2013 FUJITSU LIMITED. All rights reserved.
17-
* Copyright (c) 2014-2016 Research Organization for Information Science
17+
* Copyright (c) 2014-2017 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* $COPYRIGHT$
2020
*
@@ -43,7 +43,6 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
4343
mca_coll_base_module_t *module)
4444
{
4545
int i, j, size, rank, err=MPI_SUCCESS;
46-
ompi_request_t *req;
4746
char *allocated_buffer, *tmp_buffer;
4847
size_t max_size, rdtype_size;
4948
OPAL_PTRDIFF_TYPE ext, gap = 0;
@@ -78,43 +77,33 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
7877
/* in-place alltoallv slow algorithm (but works) */
7978
for (i = 0 ; i < size ; ++i) {
8079
for (j = i+1 ; j < size ; ++j) {
81-
if (i == rank && rcounts[j]) {
80+
if (i == rank) {
8281
/* Copy the data into the temporary buffer */
8382
err = ompi_datatype_copy_content_same_ddt (rdtype, rcounts[j],
8483
tmp_buffer, (char *) rbuf + rdisps[j] * ext);
8584
if (MPI_SUCCESS != err) { goto error_hndl; }
8685

8786
/* Exchange data with the peer */
88-
err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[j] * ext, rcounts[j], rdtype,
89-
j, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &req));
87+
err = ompi_coll_base_sendrecv_actual((void *) tmp_buffer, rcounts[j], rdtype,
88+
j, MCA_COLL_BASE_TAG_ALLTOALLV,
89+
(char *)rbuf + rdisps[j] * ext, rcounts[j], rdtype,
90+
j, MCA_COLL_BASE_TAG_ALLTOALLV,
91+
comm, MPI_STATUS_IGNORE);
9092
if (MPI_SUCCESS != err) { goto error_hndl; }
91-
92-
err = MCA_PML_CALL(send ((void *) tmp_buffer, rcounts[j], rdtype,
93-
j, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD,
94-
comm));
95-
if (MPI_SUCCESS != err) { goto error_hndl; }
96-
} else if (j == rank && rcounts[i]) {
93+
} else if (j == rank) {
9794
/* Copy the data into the temporary buffer */
9895
err = ompi_datatype_copy_content_same_ddt (rdtype, rcounts[i],
9996
tmp_buffer, (char *) rbuf + rdisps[i] * ext);
10097
if (MPI_SUCCESS != err) { goto error_hndl; }
10198

10299
/* Exchange data with the peer */
103-
err = MCA_PML_CALL(irecv ((char *) rbuf + rdisps[i] * ext, rcounts[i], rdtype,
104-
i, MCA_COLL_BASE_TAG_ALLTOALLV, comm, &req));
100+
err = ompi_coll_base_sendrecv_actual((void *) tmp_buffer, rcounts[i], rdtype,
101+
i, MCA_COLL_BASE_TAG_ALLTOALLV,
102+
(char *) rbuf + rdisps[i] * ext, rcounts[i], rdtype,
103+
i, MCA_COLL_BASE_TAG_ALLTOALLV,
104+
comm, MPI_STATUS_IGNORE);
105105
if (MPI_SUCCESS != err) { goto error_hndl; }
106-
107-
err = MCA_PML_CALL(send ((void *) tmp_buffer, rcounts[i], rdtype,
108-
i, MCA_COLL_BASE_TAG_ALLTOALLV, MCA_PML_BASE_SEND_STANDARD,
109-
comm));
110-
if (MPI_SUCCESS != err) { goto error_hndl; }
111-
} else {
112-
continue;
113106
}
114-
115-
/* Wait for the requests to complete */
116-
err = ompi_request_wait (&req, MPI_STATUSES_IGNORE);
117-
if (MPI_SUCCESS != err) { goto error_hndl; }
118107
}
119108
}
120109

@@ -242,7 +231,7 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts
242231

243232
/* Post all receives first */
244233
for (i = 0; i < size; ++i) {
245-
if (i == rank || 0 == rcounts[i]) {
234+
if (i == rank) {
246235
continue;
247236
}
248237

@@ -256,7 +245,7 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts
256245

257246
/* Now post all sends */
258247
for (i = 0; i < size; ++i) {
259-
if (i == rank || 0 == scounts[i]) {
248+
if (i == rank) {
260249
continue;
261250
}
262251

0 commit comments

Comments
 (0)