Skip to content

Commit 10f00ad

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 <[email protected]> (back-ported from commit bc1cab5)
1 parent 87b7e56 commit 10f00ad

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
@@ -15,6 +15,8 @@
1515
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1717
* reserved.
18+
* Copyright (c) 2019 Research Organization for Information Science
19+
* and Technology (RIST). All rights reserved.
1820
* $COPYRIGHT$
1921
*
2022
* Additional copyrights may follow
@@ -569,9 +571,16 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source,
569571

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

0 commit comments

Comments
 (0)