Skip to content

Commit 530f2b5

Browse files
ggouaillardetawlauria
authored andcommitted
coll/basic: correctly handle zero size datatypes in scatterv
Since no message is sent/received when the count is zero, do not send/receive any message when the datatype size is zero. Refs. #9619 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp> (cherry picked from commit f4a3961)
1 parent ffd6f2b commit 530f2b5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ompi/mca/coll/basic/coll_basic_scatterv.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2015 Research Organization for Information Science
13-
* and Technology (RIST). All rights reserved.
12+
* Copyright (c) 2015-2021 Research Organization for Information Science
13+
* and Technology (RIST). All rights reserved.
1414
* Copyright (c) 2017 IBM Corporation. All rights reserved.
1515
* $COPYRIGHT$
1616
*
@@ -49,6 +49,7 @@ mca_coll_basic_scatterv_intra(const void *sbuf, const int *scounts,
4949
int i, rank, size, err;
5050
char *ptmp;
5151
ptrdiff_t lb, extent;
52+
size_t sdsize;
5253

5354
/* Initialize */
5455

@@ -58,15 +59,23 @@ mca_coll_basic_scatterv_intra(const void *sbuf, const int *scounts,
5859
/* If not root, receive data. */
5960

6061
if (rank != root) {
62+
size_t rdsize;
63+
ompi_datatype_type_size(rdtype, &rdsize);
6164
/* Only receive if there is something to receive */
62-
if (rcount > 0) {
65+
if (rcount > 0 && rdsize > 0) {
6366
return MCA_PML_CALL(recv(rbuf, rcount, rdtype,
6467
root, MCA_COLL_BASE_TAG_SCATTERV,
6568
comm, MPI_STATUS_IGNORE));
6669
}
6770
return MPI_SUCCESS;
6871
}
6972

73+
ompi_datatype_type_size(sdtype, &sdsize);
74+
if (OPAL_UNLIKELY(0 == sdsize)) {
75+
/* bozzo case */
76+
return MPI_SUCCESS;
77+
}
78+
7079
/* I am the root, loop sending data. */
7180

7281
err = ompi_datatype_get_extent(sdtype, &lb, &extent);

0 commit comments

Comments
 (0)