Skip to content

Commit 88d7810

Browse files
committed
coll/tuned: Fix MPI_IN_PLACE processing in tuned algorithms
PR #5450 addresses MPI_IN_PLACE processing for basic collective algorithms. But in conjunction with that, we need to check for MPI_IN_PLACE in tuned paths as well before calling ompi_datatype_type_size() as otherwise we segfault. MPI spec also stipulates to ignore sendcount and sendtype for Alltoall and Allgatherv operations. So, extending the check to these algorithms as well. Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@intel.com>
1 parent c186004 commit 88d7810

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

ompi/mca/coll/tuned/coll_tuned_decision_fixed.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(const void *sbuf, int scount,
119119
the University of Tennessee (2GB MX) up to 64 nodes.
120120
Has better performance for messages of intermediate sizes than the old one */
121121
/* determine block size */
122-
ompi_datatype_type_size(sdtype, &dsize);
122+
if (MPI_IN_PLACE != sbuf) {
123+
ompi_datatype_type_size(sdtype, &dsize);
124+
} else {
125+
ompi_datatype_type_size(rdtype, &dsize);
126+
}
123127
block_dsize = dsize * (ptrdiff_t)scount;
124128

125129
if ((block_dsize < (size_t) ompi_coll_tuned_alltoall_small_msg)
@@ -549,7 +553,11 @@ int ompi_coll_tuned_allgather_intra_dec_fixed(const void *sbuf, int scount,
549553
}
550554

551555
/* Determine complete data size */
552-
ompi_datatype_type_size(sdtype, &dsize);
556+
if (MPI_IN_PLACE != sbuf) {
557+
ompi_datatype_type_size(sdtype, &dsize);
558+
} else {
559+
ompi_datatype_type_size(rdtype, &dsize);
560+
}
553561
total_dsize = dsize * (ptrdiff_t)scount * (ptrdiff_t)communicator_size;
554562

555563
OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgather_intra_dec_fixed"
@@ -644,7 +652,12 @@ int ompi_coll_tuned_allgatherv_intra_dec_fixed(const void *sbuf, int scount,
644652
}
645653

646654
/* Determine complete data size */
647-
ompi_datatype_type_size(sdtype, &dsize);
655+
if (MPI_IN_PLACE != sbuf) {
656+
ompi_datatype_type_size(sdtype, &dsize);
657+
} else {
658+
ompi_datatype_type_size(rdtype, &dsize);
659+
}
660+
648661
total_dsize = 0;
649662
for (i = 0; i < communicator_size; i++) {
650663
total_dsize += dsize * (ptrdiff_t)rcounts[i];

0 commit comments

Comments
 (0)