Skip to content

Commit 86cbf34

Browse files
committed
Merge branch 'issue-522-co_reduce_fix' of github.com:sourceryinstitute/OpenCoarrays into debug-config-fix
2 parents d01de24 + 111c695 commit 86cbf34

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/mpi/mpi_caf.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,19 @@ bool caf_owns_mpi = false;
263263

264264
/* Foo function pointers for coreduce.
265265
The handles when arguments are passed by reference. */
266+
int (*int8_t_by_reference)(void *, void *);
267+
int (*int16_t_by_reference)(void *, void *);
266268
int (*int32_t_by_reference)(void *, void *);
269+
int (*int64_t_by_reference)(void *, void *);
267270
float (*float_by_reference)(void *, void *);
268271
double (*double_by_reference)(void *, void *);
269272
/* Strings are always passed by reference. */
270273
void (*char_by_reference)(void *, int, void *, void *, int, int);
271274
/* The handles when arguments are passed by value. */
275+
int8_t (*int8_t_by_value)(int8_t, int8_t);
276+
int16_t (*int16_t_by_value)(int16_t, int16_t);
272277
int (*int32_t_by_value)(int32_t, int32_t);
278+
int64_t (*int64_t_by_value)(int64_t, int64_t);
273279
float (*float_by_value)(float, float);
274280
double (*double_by_value)(double, double);
275281

@@ -6635,7 +6641,10 @@ name##_by_value_adapter (void *invec, void *inoutvec, int *len, \
66356641
} \
66366642
}
66376643

6644+
GEN_COREDUCE (redux_int8, int8_t)
6645+
GEN_COREDUCE (redux_int16, int16_t)
66386646
GEN_COREDUCE (redux_int32, int32_t)
6647+
GEN_COREDUCE (redux_int64, int64_t)
66396648
GEN_COREDUCE (redux_real32, float)
66406649
GEN_COREDUCE (redux_real64, double)
66416650

@@ -6979,8 +6988,20 @@ PREFIX (co_reduce) (gfc_descriptor_t *a, void *(*opr) (void *, void *), int opr_
69796988
* arguments to be passed by value. */
69806989
if ((opr_flags & GFC_CAF_ARG_VALUE) > 0)
69816990
{
6982-
int32_t_by_value = (typeof (VALUE_FUNC(int32_t)))opr;
6983-
MPI_Op_create(redux_int32_by_value_adapter, 1, &op);
6991+
#define ifTypeGen(type) if (GFC_DESCRIPTOR_SIZE(a) == sizeof (type ## _t)) \
6992+
{ \
6993+
type ## _t_by_value = (typeof (VALUE_FUNC(type ## _t)))opr; \
6994+
MPI_Op_create(redux_ ## type ## _by_value_adapter, 1, &op); \
6995+
}
6996+
6997+
ifTypeGen(int8)
6998+
else ifTypeGen(int16)
6999+
else ifTypeGen(int32)
7000+
else ifTypeGen(int64)
7001+
else
7002+
{
7003+
caf_runtime_error ("CO_REDUCE unsupported integer datatype");
7004+
}
69847005
}
69857006
else
69867007
{

0 commit comments

Comments
 (0)