2004-04-21 02:37:46 +04:00
|
|
|
/*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-04-21 02:37:46 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-04-21 02:37:46 +04:00
|
|
|
|
2005-08-13 01:42:07 +04:00
|
|
|
#include "ompi/include/constants.h"
|
2004-04-21 02:37:46 +04:00
|
|
|
#include "op/op.h"
|
|
|
|
#include "op/op_predefined.h"
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "class/ompi_pointer_array.h"
|
2004-06-29 04:02:25 +04:00
|
|
|
#include "datatype/datatype_internal.h"
|
2004-04-21 02:37:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Table for Fortran <-> C op handle conversion
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_pointer_array_t *ompi_op_f_to_c_table;
|
2004-04-21 02:37:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create intrinsic op
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
static int add_intrinsic(ompi_op_t *op, int fort_handle);
|
2004-04-21 02:37:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class information
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
static void ompi_op_construct(ompi_op_t *eh);
|
|
|
|
static void ompi_op_destruct(ompi_op_t *eh);
|
2004-04-21 02:37:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class instance
|
|
|
|
*/
|
2005-07-03 20:06:07 +04:00
|
|
|
OBJ_CLASS_INSTANCE(ompi_op_t, opal_object_t,
|
2004-06-29 04:02:25 +04:00
|
|
|
ompi_op_construct, ompi_op_destruct);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Helpful defines, because there's soooo many names!
|
|
|
|
*/
|
2005-05-20 03:56:02 +04:00
|
|
|
|
|
|
|
/** C integer ***********************************************************/
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
#define C_INTEGER(name) \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ ompi_mpi_op_##name##_int }, /* OMPI_OP_TYPE_INT */ \
|
|
|
|
{ ompi_mpi_op_##name##_long }, /* OMPI_OP_TYPE_LONG */ \
|
|
|
|
{ ompi_mpi_op_##name##_short }, /* OMPI_OP_TYPE_SHORT */ \
|
|
|
|
{ ompi_mpi_op_##name##_unsigned_short }, /* OMPI_OP_TYPE_UNSIGNED_SHORT */ \
|
|
|
|
{ ompi_mpi_op_##name##_unsigned }, /* OMPI_OP_TYPE_UNSIGNED */ \
|
|
|
|
{ ompi_mpi_op_##name##_unsigned_long } /* OMPI_OP_TYPE_UNSIGNED_LONG */
|
2004-06-29 04:02:25 +04:00
|
|
|
#define C_INTEGER_NULL \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ NULL }, /* OMPI_OP_TYPE_INT */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_LONG */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_SHORT */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_UNSIGNED_SHORT */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_UNSIGNED */ \
|
|
|
|
{ NULL } /* OMPI_OP_TYPE_UNSIGNED_LONG */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2005-05-20 03:56:02 +04:00
|
|
|
/** All the Fortran integers ********************************************/
|
|
|
|
|
|
|
|
#if OMPI_HAVE_FORTRAN_INTEGER
|
|
|
|
#define FORTRAN_INTEGER_PLAIN(name) { ompi_mpi_op_##name##_fortran_integer }
|
|
|
|
#else
|
|
|
|
#define FORTRAN_INTEGER_PLAIN(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_INTEGER1
|
|
|
|
#define FORTRAN_INTEGER1(name) { ompi_mpi_op_##name##_fortran_integer1 }
|
|
|
|
#else
|
|
|
|
#define FORTRAN_INTEGER1(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_INTEGER2
|
|
|
|
#define FORTRAN_INTEGER2(name) { ompi_mpi_op_##name##_fortran_integer2 }
|
|
|
|
#else
|
|
|
|
#define FORTRAN_INTEGER2(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_INTEGER4
|
|
|
|
#define FORTRAN_INTEGER4(name) { ompi_mpi_op_##name##_fortran_integer4 }
|
|
|
|
#else
|
|
|
|
#define FORTRAN_INTEGER4(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_INTEGER8
|
|
|
|
#define FORTRAN_INTEGER8(name) { ompi_mpi_op_##name##_fortran_integer8 }
|
|
|
|
#else
|
|
|
|
#define FORTRAN_INTEGER8(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_INTEGER16
|
|
|
|
#define FORTRAN_INTEGER16(name) { ompi_mpi_op_##name##_fortran_integer16 }
|
|
|
|
#else
|
|
|
|
#define FORTRAN_INTEGER16(name) { NULL }
|
|
|
|
#endif
|
2004-06-29 04:02:25 +04:00
|
|
|
#define FORTRAN_INTEGER(name) \
|
2005-05-20 03:56:02 +04:00
|
|
|
FORTRAN_INTEGER_PLAIN(name), /* OMPI_OP_TYPE_INTEGER */ \
|
|
|
|
FORTRAN_INTEGER1(name), /* OMPI_OP_TYPE_INTEGER1 */ \
|
|
|
|
FORTRAN_INTEGER2(name), /* OMPI_OP_TYPE_INTEGER2 */ \
|
|
|
|
FORTRAN_INTEGER4(name), /* OMPI_OP_TYPE_INTEGER4 */ \
|
|
|
|
FORTRAN_INTEGER8(name), /* OMPI_OP_TYPE_INTEGER8 */ \
|
|
|
|
FORTRAN_INTEGER16(name) /* OMPI_OP_TYPE_INTEGER16 */
|
2004-06-29 04:02:25 +04:00
|
|
|
#define FORTRAN_INTEGER_NULL \
|
2005-05-20 03:56:02 +04:00
|
|
|
{ NULL }, /* OMPI_OP_TYPE_INTEGER */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_INTEGER1 */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_INTEGER2 */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_INTEGER4 */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_INTEGER8 */ \
|
|
|
|
{ NULL } /* OMPI_OP_TYPE_INTEGER16 */
|
|
|
|
|
|
|
|
/** All the Fortran reals ***********************************************/
|
|
|
|
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL_PLAIN(name) { ompi_mpi_op_##name##_fortran_real }
|
|
|
|
#else
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL_PLAIN(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL4
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL4(name) { ompi_mpi_op_##name##_fortran_real4 }
|
|
|
|
#else
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL4(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL8
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL8(name) { ompi_mpi_op_##name##_fortran_real8 }
|
|
|
|
#else
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL8(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL16
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL16(name) { ompi_mpi_op_##name##_fortran_real16 }
|
|
|
|
#else
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL16(name) { NULL }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FLOATING_POINT_FORTRAN_REAL(name) \
|
|
|
|
FLOATING_POINT_FORTRAN_REAL_PLAIN(name), /* OMPI_OP_TYPE_REAL */ \
|
|
|
|
FLOATING_POINT_FORTRAN_REAL4(name), /* OMPI_OP_TYPE_REAL4 */ \
|
|
|
|
FLOATING_POINT_FORTRAN_REAL8(name), /* OMPI_OP_TYPE_REAL8 */ \
|
|
|
|
FLOATING_POINT_FORTRAN_REAL16(name) /* OMPI_OP_TYPE_REAL16 */
|
|
|
|
|
|
|
|
/** Fortran double precision ********************************************/
|
|
|
|
|
|
|
|
#if OMPI_HAVE_FORTRAN_DOUBLE_PRECISION
|
|
|
|
#define FLOATING_POINT_FORTRAN_DOUBLE_PRECISION(name) \
|
|
|
|
{ ompi_mpi_op_##name##_fortran_double_precision }
|
|
|
|
#else
|
|
|
|
#define FLOATING_POINT_FORTRAN_DOUBLE_PRECISION(name) { NULL }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Floating point, including all the Fortran reals *********************/
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
#define FLOATING_POINT(name) \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ ompi_mpi_op_##name##_float }, /* OMPI_OP_TYPE_FLOAT */\
|
|
|
|
{ ompi_mpi_op_##name##_double }, /* OMPI_OP_TYPE_DOUBLE */\
|
2005-05-20 03:56:02 +04:00
|
|
|
FLOATING_POINT_FORTRAN_REAL(name), /* OMPI_OP_TYPE_REAL */ \
|
|
|
|
FLOATING_POINT_FORTRAN_DOUBLE_PRECISION(name), /* OMPI_OP_TYPE_DOUBLE_PRECISION */ \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ ompi_mpi_op_##name##_long_double } /* OMPI_OP_TYPE_LONG_DOUBLE */
|
2004-06-29 04:02:25 +04:00
|
|
|
#define FLOATING_POINT_NULL \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ NULL }, /* OMPI_OP_TYPE_FLOAT */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_DOUBLE */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_REAL */ \
|
2005-05-20 03:56:02 +04:00
|
|
|
{ NULL }, /* OMPI_OP_TYPE_REAL4 */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_REAL8 */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_REAL16 */ \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ NULL }, /* OMPI_OP_TYPE_DOUBLE_PRECISION */ \
|
|
|
|
{ NULL } /* OMPI_OP_TYPE_LONG_DOUBLE */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2005-05-20 03:56:02 +04:00
|
|
|
/** Fortran logical *****************************************************/
|
|
|
|
|
|
|
|
#if OMPI_HAVE_FORTRAN_LOGICAL
|
2004-06-29 04:02:25 +04:00
|
|
|
#define LOGICAL(name) \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ ompi_mpi_op_##name##_fortran_logical } /* OMPI_OP_TYPE_LOGICAL */
|
2005-05-20 03:56:02 +04:00
|
|
|
#else
|
|
|
|
#define LOGICAL(name) { NULL }
|
|
|
|
#endif
|
2004-06-29 04:02:25 +04:00
|
|
|
#define LOGICAL_NULL \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ NULL } /* OMPI_OP_TYPE_LOGICAL */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2005-05-20 03:56:02 +04:00
|
|
|
/** Fortran complex *****************************************************/
|
|
|
|
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL && OMPI_HAVE_FORTRAN_COMPLEX
|
2005-10-12 06:31:28 +04:00
|
|
|
#define COMPLEX_PLAIN(name) \
|
|
|
|
{ ompi_mpi_op_##name##_fortran_complex }, \
|
|
|
|
{ ompi_mpi_op_##name##_fortran_double_complex }
|
2005-05-20 03:56:02 +04:00
|
|
|
#else
|
2005-10-12 06:31:28 +04:00
|
|
|
#define COMPLEX_PLAIN(name) \
|
|
|
|
{ NULL }, \
|
|
|
|
{ NULL }
|
2005-05-20 03:56:02 +04:00
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL4 && OMPI_HAVE_FORTRAN_COMPLEX8
|
|
|
|
#define COMPLEX8(name) { ompi_mpi_op_##name##_fortran_complex8 }
|
|
|
|
#else
|
|
|
|
#define COMPLEX8(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL8 && OMPI_HAVE_FORTRAN_COMPLEX16
|
|
|
|
#define COMPLEX16(name) { ompi_mpi_op_##name##_fortran_complex16 }
|
|
|
|
#else
|
|
|
|
#define COMPLEX16(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_HAVE_FORTRAN_COMPLEX32
|
|
|
|
#define COMPLEX32(name) { ompi_mpi_op_##name##_fortran_complex32 }
|
|
|
|
#else
|
|
|
|
#define COMPLEX32(name) { NULL }
|
|
|
|
#endif
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
#define COMPLEX(name) \
|
2005-05-20 03:56:02 +04:00
|
|
|
COMPLEX_PLAIN(name), /* OMPI_OP_TYPE_COMPLEX */ \
|
|
|
|
COMPLEX8(name), /* OMPI_OP_TYPE_COMPLEX8 */ \
|
|
|
|
COMPLEX16(name), /* OMPI_OP_TYPE_COMPLEX16 */ \
|
|
|
|
COMPLEX32(name) /* OMPI_OP_TYPE_COMPLEX32 */
|
2004-06-29 04:02:25 +04:00
|
|
|
#define COMPLEX_NULL \
|
2005-10-12 06:31:28 +04:00
|
|
|
{ NULL }, /* OMPI_OP_TYPE_COMPLEX (single) */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_COMPLEX (double) */ \
|
2005-05-20 03:56:02 +04:00
|
|
|
{ NULL }, /* OMPI_OP_TYPE_COMPLEX8 */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_COMPLEX16 */ \
|
|
|
|
{ NULL } /* OMPI_OP_TYPE_COMPLEX32 */
|
|
|
|
|
|
|
|
/** Byte ****************************************************************/
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
#define BYTE(name) \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ ompi_mpi_op_##name##_byte } /* OMPI_OP_TYPE_BYTE */
|
2004-06-29 04:02:25 +04:00
|
|
|
#define BYTE_NULL \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ NULL } /* OMPI_OP_TYPE_BYTE */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2005-05-20 03:56:02 +04:00
|
|
|
/** Fortran complex *****************************************************/
|
|
|
|
/** Fortran "2" types ***************************************************/
|
|
|
|
|
|
|
|
#if OMPI_HAVE_FORTRAN_REAL
|
|
|
|
#define TWOLOC_FORTRAN_2REAL(name) { ompi_mpi_op_##name##_2real }
|
|
|
|
#else
|
|
|
|
#define TWOLOC_FORTRAN_2REAL(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_DOUBLE_PRECISION
|
|
|
|
#define TWOLOC_FORTRAN_2DOUBLE_PRECISION(name) { ompi_mpi_op_##name##_2double_precision }
|
|
|
|
#else
|
|
|
|
#define TWOLOC_FORTRAN_2DOUBLE_PRECISION(name) { NULL }
|
|
|
|
#endif
|
|
|
|
#if OMPI_HAVE_FORTRAN_INTEGER
|
|
|
|
#define TWOLOC_FORTRAN_2INTEGER(name) { ompi_mpi_op_##name##_2integer }
|
|
|
|
#else
|
|
|
|
#define TWOLOC_FORTRAN_2INTEGER(name) { NULL }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** All "2" types *******************************************************/
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
#define TWOLOC(name) \
|
2005-05-20 03:56:02 +04:00
|
|
|
TWOLOC_FORTRAN_2REAL(name), /* OMPI_OP_TYPE_2REAL */ \
|
|
|
|
TWOLOC_FORTRAN_2DOUBLE_PRECISION(name), /* OMPI_OP_TYPE_2DOUBLE_PRECISION */ \
|
|
|
|
TWOLOC_FORTRAN_2INTEGER(name), /* OMPI_OP_TYPE_2INTEGER */ \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ ompi_mpi_op_##name##_float_int }, /* OMPI_OP_TYPE_FLOAT_INT */ \
|
|
|
|
{ ompi_mpi_op_##name##_double_int }, /* OMPI_OP_TYPE_DOUBLE_INT */ \
|
|
|
|
{ ompi_mpi_op_##name##_long_int }, /* OMPI_OP_TYPE_LONG_INT */ \
|
|
|
|
{ ompi_mpi_op_##name##_2int }, /* OMPI_OP_TYPE_2INT */ \
|
|
|
|
{ ompi_mpi_op_##name##_short_int }, /* OMPI_OP_TYPE_SHORT_INT */ \
|
|
|
|
{ ompi_mpi_op_##name##_long_double_int } /* OMPI_OP_TYPE_LONG_DOUBLE_INT */
|
2004-06-29 04:02:25 +04:00
|
|
|
#define TWOLOC_NULL \
|
2005-02-10 03:01:42 +03:00
|
|
|
{ NULL }, /* OMPI_OP_TYPE_2REAL */\
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_2DOUBLE_PRECISION */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_2INTEGER */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_FLOAT_INT */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_DOUBLE_INT */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_LONG_INT */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_2INT */ \
|
|
|
|
{ NULL }, /* OMPI_OP_TYPE_SHORT_INT */ \
|
|
|
|
{ NULL } /* OMPI_OP_TYPE_LONG_DOUBLE_INT */
|
2004-04-21 02:37:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_NULL
|
2004-06-29 04:02:25 +04:00
|
|
|
* All types
|
2004-04-21 02:37:46 +04:00
|
|
|
*/
|
2005-09-08 13:47:27 +04:00
|
|
|
#define FLAGS_NO_FLOAT \
|
|
|
|
(OMPI_OP_FLAGS_INTRINSIC | OMPI_OP_FLAGS_ASSOC | OMPI_OP_FLAGS_COMMUTE)
|
|
|
|
#define FLAGS \
|
|
|
|
(OMPI_OP_FLAGS_INTRINSIC | OMPI_OP_FLAGS_ASSOC | \
|
|
|
|
OMPI_OP_FLAGS_FLOAT_ASSOC | OMPI_OP_FLAGS_COMMUTE)
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_null = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_NULL",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER_NULL,
|
|
|
|
FORTRAN_INTEGER_NULL,
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE_NULL,
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_MAX
|
2004-06-29 04:02:25 +04:00
|
|
|
* C integer, Fortran integer, Floating point
|
2004-04-21 02:37:46 +04:00
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_max = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_MAX",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(max),
|
|
|
|
FORTRAN_INTEGER(max),
|
|
|
|
FLOATING_POINT(max),
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE_NULL,
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_MIN
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_min = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_MIN",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(min),
|
|
|
|
FORTRAN_INTEGER(min),
|
|
|
|
FLOATING_POINT(min),
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE_NULL,
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_SUM
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_sum = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_SUM",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS_NO_FLOAT,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(sum),
|
|
|
|
FORTRAN_INTEGER(sum),
|
|
|
|
FLOATING_POINT(sum),
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX(sum),
|
|
|
|
BYTE_NULL,
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_PROD
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_prod = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_PROD",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS_NO_FLOAT,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(prod),
|
|
|
|
FORTRAN_INTEGER(prod),
|
|
|
|
FLOATING_POINT(prod),
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX(prod),
|
|
|
|
BYTE_NULL,
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_LAND
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_land = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_LAND",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(land),
|
|
|
|
FORTRAN_INTEGER_NULL,
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL(land),
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE_NULL,
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_BAND
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_band = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_BAND",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(band),
|
|
|
|
FORTRAN_INTEGER(band),
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE(band),
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_LOR
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_lor = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_LOR",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(lor),
|
|
|
|
FORTRAN_INTEGER_NULL,
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL(lor),
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE_NULL,
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_BOR
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_bor = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_BOR",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(bor),
|
|
|
|
FORTRAN_INTEGER(bor),
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE(bor),
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_LXOR
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_lxor = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_LXOR",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(lxor),
|
|
|
|
FORTRAN_INTEGER_NULL,
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL(lxor),
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE_NULL,
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_BXOR
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_bxor = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_BXOR",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2004-06-29 04:02:25 +04:00
|
|
|
{ C_INTEGER(bxor),
|
|
|
|
FORTRAN_INTEGER(bxor),
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE(bxor),
|
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_MAXLOC
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_maxloc = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_MAXLOC",
|
2004-06-29 04:02:25 +04:00
|
|
|
(OMPI_OP_FLAGS_INTRINSIC | OMPI_OP_FLAGS_ASSOC | OMPI_OP_FLAGS_COMMUTE),
|
|
|
|
{ C_INTEGER_NULL,
|
|
|
|
FORTRAN_INTEGER_NULL,
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE_NULL,
|
2004-07-14 23:16:43 +04:00
|
|
|
TWOLOC(maxloc) }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_MINLOC
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t ompi_mpi_op_minloc = {
|
2004-04-21 02:37:46 +04:00
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_MINLOC",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2005-02-10 06:35:36 +03:00
|
|
|
{ C_INTEGER_NULL,
|
|
|
|
FORTRAN_INTEGER_NULL,
|
|
|
|
FLOATING_POINT_NULL,
|
|
|
|
LOGICAL_NULL,
|
|
|
|
COMPLEX_NULL,
|
|
|
|
BYTE_NULL,
|
2004-07-14 23:16:43 +04:00
|
|
|
TWOLOC(minloc) }
|
2004-07-13 19:24:58 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MPI_OP_REPLACE
|
|
|
|
*/
|
|
|
|
ompi_op_t ompi_mpi_op_replace = {
|
|
|
|
{ NULL, 0 },
|
|
|
|
|
|
|
|
"MPI_OP_REPLACE",
|
2005-09-08 13:47:27 +04:00
|
|
|
FLAGS,
|
2005-02-10 06:35:36 +03:00
|
|
|
{ C_INTEGER(replace),
|
|
|
|
FORTRAN_INTEGER(replace),
|
|
|
|
FLOATING_POINT(replace),
|
|
|
|
LOGICAL(replace),
|
|
|
|
COMPLEX(replace),
|
|
|
|
BYTE(replace),
|
2004-06-29 04:02:25 +04:00
|
|
|
TWOLOC_NULL }
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
2004-06-29 04:02:25 +04:00
|
|
|
* Map from ddt->id to position in op function pointer array
|
2004-04-21 02:37:46 +04:00
|
|
|
*/
|
2005-05-09 22:03:29 +04:00
|
|
|
int ompi_op_ddt_map[DT_MAX_PREDEFINED];
|
2004-04-21 02:37:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-06-07 19:33:53 +04:00
|
|
|
* Initialize OMPI op infrastructure
|
2004-04-21 02:37:46 +04:00
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_op_init(void)
|
2004-04-21 02:37:46 +04:00
|
|
|
{
|
2004-06-29 04:02:25 +04:00
|
|
|
int i;
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
/* initialize ompi_op_f_to_c_table */
|
2004-04-21 02:37:46 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_f_to_c_table = OBJ_NEW(ompi_pointer_array_t);
|
|
|
|
if (NULL == ompi_op_f_to_c_table){
|
|
|
|
return OMPI_ERROR;
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/* Fill in the ddt.id->op_position map */
|
|
|
|
|
|
|
|
for (i = 0; i < DT_MAX_PREDEFINED; ++i)
|
|
|
|
ompi_op_ddt_map[i] = -1;
|
|
|
|
|
|
|
|
ompi_op_ddt_map[DT_BYTE] = OMPI_OP_TYPE_BYTE;
|
|
|
|
ompi_op_ddt_map[DT_SHORT] = OMPI_OP_TYPE_SHORT;
|
|
|
|
ompi_op_ddt_map[DT_UNSIGNED_SHORT] = OMPI_OP_TYPE_UNSIGNED_SHORT;
|
|
|
|
ompi_op_ddt_map[DT_INT] = OMPI_OP_TYPE_INT;
|
2004-09-30 01:08:29 +04:00
|
|
|
ompi_op_ddt_map[DT_UNSIGNED_INT] = OMPI_OP_TYPE_UNSIGNED;
|
2004-06-29 04:02:25 +04:00
|
|
|
ompi_op_ddt_map[DT_LONG] = OMPI_OP_TYPE_LONG;
|
|
|
|
ompi_op_ddt_map[DT_UNSIGNED_LONG] = OMPI_OP_TYPE_UNSIGNED_LONG;
|
|
|
|
ompi_op_ddt_map[DT_FLOAT] = OMPI_OP_TYPE_FLOAT;
|
|
|
|
ompi_op_ddt_map[DT_DOUBLE] = OMPI_OP_TYPE_DOUBLE;
|
|
|
|
ompi_op_ddt_map[DT_LONG_DOUBLE] = OMPI_OP_TYPE_LONG_DOUBLE;
|
|
|
|
ompi_op_ddt_map[DT_COMPLEX_FLOAT] = OMPI_OP_TYPE_COMPLEX;
|
2005-10-12 06:31:28 +04:00
|
|
|
ompi_op_ddt_map[DT_COMPLEX_DOUBLE] = OMPI_OP_TYPE_DOUBLE_COMPLEX;
|
2004-06-29 04:02:25 +04:00
|
|
|
ompi_op_ddt_map[DT_LOGIC] = OMPI_OP_TYPE_LOGICAL;
|
|
|
|
ompi_op_ddt_map[DT_FLOAT_INT] = OMPI_OP_TYPE_FLOAT_INT;
|
|
|
|
ompi_op_ddt_map[DT_DOUBLE_INT] = OMPI_OP_TYPE_DOUBLE_INT;
|
|
|
|
ompi_op_ddt_map[DT_LONG_INT] = OMPI_OP_TYPE_LONG_INT;
|
|
|
|
ompi_op_ddt_map[DT_2INT] = OMPI_OP_TYPE_2INT;
|
|
|
|
ompi_op_ddt_map[DT_SHORT_INT] = OMPI_OP_TYPE_SHORT_INT;
|
|
|
|
ompi_op_ddt_map[DT_INTEGER] = OMPI_OP_TYPE_INTEGER;
|
|
|
|
ompi_op_ddt_map[DT_REAL] = OMPI_OP_TYPE_REAL;
|
|
|
|
ompi_op_ddt_map[DT_DBLPREC] = OMPI_OP_TYPE_DOUBLE_PRECISION;
|
|
|
|
ompi_op_ddt_map[DT_2REAL] = OMPI_OP_TYPE_2REAL;
|
|
|
|
ompi_op_ddt_map[DT_2DBLPREC] = OMPI_OP_TYPE_2DOUBLE_PRECISION;
|
|
|
|
ompi_op_ddt_map[DT_2INTEGER] = OMPI_OP_TYPE_2INTEGER;
|
2004-09-16 12:49:34 +04:00
|
|
|
ompi_op_ddt_map[DT_LONG_DOUBLE_INT] = OMPI_OP_TYPE_LONG_DOUBLE_INT;
|
2004-06-29 04:02:25 +04:00
|
|
|
ompi_op_ddt_map[DT_WCHAR] = OMPI_OP_TYPE_WCHAR;
|
|
|
|
|
2004-04-21 02:37:46 +04:00
|
|
|
/* Create the intrinsic ops */
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
if (add_intrinsic(&ompi_mpi_op_null, OMPI_OP_FORTRAN_NULL) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_max, OMPI_OP_FORTRAN_MAX) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_min, OMPI_OP_FORTRAN_MIN) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_sum, OMPI_OP_FORTRAN_SUM) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_prod, OMPI_OP_FORTRAN_PROD) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_land, OMPI_OP_FORTRAN_LAND) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_band, OMPI_OP_FORTRAN_BAND) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_lor, OMPI_OP_FORTRAN_LOR) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_bor, OMPI_OP_FORTRAN_BOR) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_lxor, OMPI_OP_FORTRAN_LXOR) != OMPI_SUCCESS ||
|
|
|
|
add_intrinsic(&ompi_mpi_op_bxor, OMPI_OP_FORTRAN_BXOR) != OMPI_SUCCESS ||
|
2004-06-07 19:33:53 +04:00
|
|
|
add_intrinsic(&ompi_mpi_op_maxloc,
|
2004-06-29 04:02:25 +04:00
|
|
|
OMPI_OP_FORTRAN_MAXLOC) != OMPI_SUCCESS ||
|
2004-06-07 19:33:53 +04:00
|
|
|
add_intrinsic(&ompi_mpi_op_minloc,
|
2004-06-29 04:02:25 +04:00
|
|
|
OMPI_OP_FORTRAN_MINLOC) != OMPI_SUCCESS) {
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_ERROR;
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_SUCCESS;
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clean up the op resources
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_op_finalize(void)
|
2004-04-21 02:37:46 +04:00
|
|
|
{
|
|
|
|
/* Remove op F2C table */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
OBJ_RELEASE(ompi_op_f_to_c_table);
|
2004-04-21 02:37:46 +04:00
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_SUCCESS;
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/*
|
|
|
|
* Create a new MPI_Op
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t *ompi_op_create(bool commute,
|
2005-03-25 23:42:17 +03:00
|
|
|
ompi_op_fortran_handler_fn_t *func)
|
2004-04-21 02:37:46 +04:00
|
|
|
{
|
2004-06-29 04:02:25 +04:00
|
|
|
int i;
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_op_t *new_op;
|
2004-04-21 02:37:46 +04:00
|
|
|
|
|
|
|
/* Create a new object and ensure that it's valid */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
new_op = OBJ_NEW(ompi_op_t);
|
2004-06-29 04:02:25 +04:00
|
|
|
if (NULL != new_op) {
|
2004-06-07 19:33:53 +04:00
|
|
|
if (OMPI_ERROR == new_op->o_f_to_c_index) {
|
2004-04-21 02:37:46 +04:00
|
|
|
OBJ_RELEASE(new_op);
|
|
|
|
new_op = NULL;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* The new object is valid -- initialize it. If this is being
|
|
|
|
created from fortran, the fortran MPI API wrapper function
|
2005-03-25 23:42:17 +03:00
|
|
|
will override the o_flags field directly. We cast the
|
2004-04-21 02:37:46 +04:00
|
|
|
function pointer type to the fortran type arbitrarily -- it
|
|
|
|
only has to be a function pointer in order to store properly,
|
|
|
|
it doesn't matter what type it is (we'll cast it to the Right
|
|
|
|
type when we *use* it). */
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
new_op->o_flags = OMPI_OP_FLAGS_ASSOC;
|
|
|
|
if (commute) {
|
|
|
|
new_op->o_flags |= OMPI_OP_FLAGS_COMMUTE;
|
|
|
|
}
|
|
|
|
new_op->o_func[0].fort_fn = func;
|
|
|
|
for (i = 1; i < OMPI_OP_TYPE_MAX; ++i) {
|
|
|
|
new_op->o_func[i].fort_fn = NULL;
|
|
|
|
}
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All done */
|
2004-04-21 03:11:11 +04:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
return new_op;
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* Static functions
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
static int add_intrinsic(ompi_op_t *op, int fort_handle)
|
2004-04-21 02:37:46 +04:00
|
|
|
{
|
|
|
|
int ret_val;
|
|
|
|
|
|
|
|
/* Add the op to the table */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ret_val = ompi_pointer_array_add(ompi_op_f_to_c_table, op);
|
2004-04-21 02:37:46 +04:00
|
|
|
if (-1 == ret_val){
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_ERROR;
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure that the op is in the right location in the table */
|
|
|
|
|
|
|
|
if (fort_handle != ret_val) {
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_ERROR;
|
2004-04-21 02:37:46 +04:00
|
|
|
};
|
|
|
|
op->o_f_to_c_index = ret_val;
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
return OMPI_SUCCESS;
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Op constructor
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
static void ompi_op_construct(ompi_op_t *new_op)
|
2004-04-21 02:37:46 +04:00
|
|
|
{
|
|
|
|
int ret_val;
|
|
|
|
|
|
|
|
/* assign entry in fortran <-> c translation array */
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
ret_val = ompi_pointer_array_add(ompi_op_f_to_c_table, new_op);
|
2004-04-21 02:37:46 +04:00
|
|
|
new_op->o_f_to_c_index = ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Op destructor
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
static void ompi_op_destruct(ompi_op_t *op)
|
2004-04-21 02:37:46 +04:00
|
|
|
{
|
2004-06-07 19:33:53 +04:00
|
|
|
/* reset the ompi_op_f_to_c_table entry - make sure that the
|
2004-04-21 02:37:46 +04:00
|
|
|
entry is in the table */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if (NULL!= ompi_pointer_array_get_item(ompi_op_f_to_c_table,
|
2004-06-29 04:02:25 +04:00
|
|
|
op->o_f_to_c_index)) {
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_pointer_array_set_item(ompi_op_f_to_c_table,
|
2004-06-29 04:02:25 +04:00
|
|
|
op->o_f_to_c_index, NULL);
|
2004-04-21 02:37:46 +04:00
|
|
|
}
|
|
|
|
}
|