Skip to content

Commit bc1cab5

Browse files
committed
ompi/op: fix support of non predefined datatypes with predefined operators
ACCUMULATE, unlike REDUCE, can use with derived datatypes with predefinied operations, with some restrictions outlined in MPI-3:11.3.4. The derived datatype must be composed entierly from one predefined datatype (so you can do all the construction you want, but at the bottom, you can only use one datatype, say, MPI_INT). Refs. #6275 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent 402606e commit bc1cab5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ompi/op/op.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
19+
* Copyright (c) 2019 Research Organization for Information Science
20+
* and Technology (RIST). All rights reserved.
1921
* $COPYRIGHT$
2022
*
2123
* Additional copyrights may follow
@@ -571,9 +573,16 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source,
571573

572574
/* For intrinsics, we also pass the corresponding op module */
573575
if (0 != (op->o_flags & OMPI_OP_FLAGS_INTRINSIC)) {
574-
op->o_func.intrinsic.fns[ompi_op_ddt_map[dtype->id]](source, target,
575-
&count, &dtype,
576-
op->o_func.intrinsic.modules[ompi_op_ddt_map[dtype->id]]);
576+
int dtype_id;
577+
if (!ompi_datatype_is_predefined(dtype)) {
578+
ompi_datatype_t *dt = ompi_datatype_get_single_predefined_type_from_args(dtype);
579+
dtype_id = ompi_op_ddt_map[dt->id];
580+
} else {
581+
dtype_id = ompi_op_ddt_map[dtype->id];
582+
}
583+
op->o_func.intrinsic.fns[dtype_id](source, target,
584+
&count, &dtype,
585+
op->o_func.intrinsic.modules[dtype_id]);
577586
return;
578587
}
579588

0 commit comments

Comments
 (0)