Skip to content

Commit 02fcc16

Browse files
committed
ompi/op: change reduce function prototypes to use a const source pointer
Signed-off-by: Alex Margolin <alex.margolin@mail.huji.ac.il>
1 parent a20ec90 commit 02fcc16

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ompi/op/op.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ BEGIN_C_DECLS
5959
* repeated code, but it's better this way (and this typedef will
6060
* never change, so there's not much of a maintenance worry).
6161
*/
62-
typedef void (ompi_op_c_handler_fn_t)(void *, void *, int *,
62+
typedef void (ompi_op_c_handler_fn_t)(const void *, void *, int *,
6363
struct ompi_datatype_t **);
6464

6565
/**
6666
* Typedef for fortran user-defined MPI_Ops.
6767
*/
68-
typedef void (ompi_op_fortran_handler_fn_t)(void *, void *,
68+
typedef void (ompi_op_fortran_handler_fn_t)(const void *, void *,
6969
MPI_Fint *, MPI_Fint *);
7070

7171
/**
7272
* Typedef for Java op functions intercept (used for user-defined
7373
* MPI.Ops).
7474
*/
75-
typedef void (ompi_op_java_handler_fn_t)(void *, void *, int *,
75+
typedef void (ompi_op_java_handler_fn_t)(const void *, void *, int *,
7676
struct ompi_datatype_t **,
7777
int baseType,
7878
void *jnienv, void *object);
@@ -500,7 +500,7 @@ static inline bool ompi_op_is_valid(ompi_op_t * op, ompi_datatype_t * ddt,
500500
* optimization). If you give it an intrinsic op with a datatype that
501501
* is not defined to have that operation, it is likely to seg fault.
502502
*/
503-
static inline void ompi_op_reduce(ompi_op_t * op, void *source,
503+
static inline void ompi_op_reduce(ompi_op_t * op, const void *source,
504504
void *target, size_t full_count,
505505
ompi_datatype_t * dtype)
506506
{
@@ -531,7 +531,7 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source,
531531
}
532532
shift = done_count * ext;
533533
// Recurse one level in iterations of 'int'
534-
ompi_op_reduce(op, (char*)source + shift, (char*)target + shift, iter_count, dtype);
534+
ompi_op_reduce(op, (const char*)source + shift, (char*)target + shift, iter_count, dtype);
535535
done_count += iter_count;
536536
}
537537
return;
@@ -595,7 +595,7 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source,
595595
static inline void ompi_3buff_op_user (ompi_op_t *op, void * restrict source1, void * restrict source2,
596596
void * restrict result, int count, struct ompi_datatype_t *dtype)
597597
{
598-
ompi_datatype_copy_content_same_ddt (dtype, count, result, source1);
598+
ompi_datatype_copy_content_same_ddt (dtype, count, (char*)result, (char*)source1);
599599
op->o_func.c_fn (source2, result, &count, &dtype);
600600
}
601601

0 commit comments

Comments
 (0)