Fixes trac:2061: add MPI_OP_COMMUTATIVE.
This commit was SVN r22128. The following Trac tickets were found above: Ticket 2061 --> https://svn.open-mpi.org/trac/ompi/ticket/2061
Этот коммит содержится в:
родитель
d86d15a15c
Коммит
bf6e3d4355
@ -1265,6 +1265,7 @@ OMPI_DECLSPEC int MPI_Keyval_free(int *keyval)
|
||||
__mpi_interface_deprecated__("MPI_Keyval_free is superseded by MPI_Comm_keyval_free in MPI-2.0");
|
||||
OMPI_DECLSPEC int MPI_Lookup_name(char *service_name, MPI_Info info, char *port_name);
|
||||
OMPI_DECLSPEC MPI_Fint MPI_Op_c2f(MPI_Op op);
|
||||
OMPI_DECLSPEC int MPI_Op_commutative(MPI_Op op, int *commute);
|
||||
OMPI_DECLSPEC int MPI_Op_create(MPI_User_function *function, int commute, MPI_Op *op);
|
||||
OMPI_DECLSPEC int MPI_Open_port(MPI_Info info, char *port_name);
|
||||
OMPI_DECLSPEC MPI_Op MPI_Op_f2c(MPI_Fint op);
|
||||
@ -1791,6 +1792,7 @@ OMPI_DECLSPEC int PMPI_Keyval_free(int *keyval)
|
||||
__mpi_interface_deprecated__("MPI_Keyval_free is superseded by MPI_Comm_keyval_free in MPI-2.0");
|
||||
OMPI_DECLSPEC int PMPI_Lookup_name(char *service_name, MPI_Info info, char *port_name);
|
||||
OMPI_DECLSPEC MPI_Fint PMPI_Op_c2f(MPI_Op op);
|
||||
OMPI_DECLSPEC int PMPI_Op_commutative(MPI_Op op, int *commute);
|
||||
OMPI_DECLSPEC int PMPI_Op_create(MPI_User_function *function, int commute, MPI_Op *op);
|
||||
OMPI_DECLSPEC int PMPI_Open_port(MPI_Info info, char *port_name);
|
||||
OMPI_DECLSPEC MPI_Op PMPI_Op_f2c(MPI_Fint op);
|
||||
|
@ -189,6 +189,7 @@ libmpi_c_mpi_la_SOURCES = \
|
||||
keyval_free.c \
|
||||
lookup_name.c \
|
||||
op_c2f.c \
|
||||
op_commutative.c \
|
||||
op_create.c \
|
||||
op_f2c.c \
|
||||
op_free.c \
|
||||
|
66
ompi/mpi/c/op_commutative.c
Обычный файл
66
ompi/mpi/c/op_commutative.c
Обычный файл
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/runtime/params.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/errhandler/errhandler.h"
|
||||
#include "ompi/op/op.h"
|
||||
|
||||
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Op_commutative = PMPI_Op_commutative
|
||||
#endif
|
||||
|
||||
#if OMPI_PROFILING_DEFINES
|
||||
#include "ompi/mpi/c/profile/defines.h"
|
||||
#endif
|
||||
|
||||
static const char FUNC_NAME[] = "MPI_Op_commutative";
|
||||
|
||||
|
||||
int MPI_Op_commutative(MPI_Op op, int *commute)
|
||||
{
|
||||
OPAL_CR_NOOP_PROGRESS();
|
||||
|
||||
/* Error checking */
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||
if (NULL == op ||
|
||||
ompi_op_is_intrinsic(op)) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OP,
|
||||
FUNC_NAME);
|
||||
}
|
||||
if (NULL == commute) {
|
||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
|
||||
FUNC_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* We have a valid op, get the flag */
|
||||
|
||||
*commute = (op->o_flags & OMPI_OP_FLAGS_COMMUTE) ? 1 : 0;
|
||||
|
||||
/* All done */
|
||||
|
||||
return MPI_SUCCESS;
|
||||
}
|
@ -172,6 +172,7 @@ nodist_libmpi_c_pmpi_la_SOURCES = \
|
||||
plookup_name.c \
|
||||
pop_c2f.c \
|
||||
pop_create.c \
|
||||
pop_commutative.c \
|
||||
pop_f2c.c \
|
||||
pop_free.c \
|
||||
popen_port.c \
|
||||
|
@ -216,6 +216,7 @@
|
||||
#define MPI_Keyval_free PMPI_Keyval_free
|
||||
#define MPI_Lookup_name PMPI_Lookup_name
|
||||
#define MPI_Op_c2f PMPI_Op_c2f
|
||||
#define MPI_Op_commutative PMPI_Op_commutative
|
||||
#define MPI_Op_create PMPI_Op_create
|
||||
#define MPI_Op_f2c PMPI_Op_f2c
|
||||
#define MPI_Op_free PMPI_Op_free
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
|
||||
virtual void Reduce_local(const void *inbuf, void *inoutbuf, int count,
|
||||
const MPI::Datatype& datatype) const;
|
||||
virtual bool Is_commutative(void) const;
|
||||
|
||||
#if ! 0 /* OMPI_ENABLE_MPI_PROFILING */
|
||||
protected:
|
||||
|
@ -138,3 +138,12 @@ MPI::Op::Reduce_local(const void *inbuf, void *inoutbuf, int count,
|
||||
(void)MPI_Reduce_local(const_cast<void*>(inbuf), inoutbuf, count,
|
||||
datatype, mpi_op);
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
MPI::Op::Is_commutative(void) const
|
||||
{
|
||||
int commute;
|
||||
(void)MPI_Op_commutative(mpi_op, &commute);
|
||||
return (bool) commute;
|
||||
}
|
||||
|
@ -200,6 +200,7 @@ libmpi_f77_la_SOURCES += \
|
||||
keyval_create_f.c \
|
||||
keyval_free_f.c \
|
||||
lookup_name_f.c \
|
||||
op_commutative_f.c \
|
||||
op_create_f.c \
|
||||
open_port_f.c \
|
||||
op_free_f.c \
|
||||
|
73
ompi/mpi/f77/op_commutative_f.c
Обычный файл
73
ompi/mpi/f77/op_commutative_f.c
Обычный файл
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "ompi/mpi/f77/bindings.h"
|
||||
|
||||
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
|
||||
#pragma weak PMPI_OP_COMMUTATIVE = mpi_op_commutative_f
|
||||
#pragma weak pmpi_op_commutative = mpi_op_commutative_f
|
||||
#pragma weak pmpi_op_commutative_ = mpi_op_commutative_f
|
||||
#pragma weak pmpi_op_commutative__ = mpi_op_commutative_f
|
||||
#elif OMPI_PROFILE_LAYER
|
||||
OMPI_GENERATE_F77_BINDINGS (PMPI_OP_COMMUTATIVE,
|
||||
pmpi_op_commutative,
|
||||
pmpi_op_commutative_,
|
||||
pmpi_op_commutative__,
|
||||
pmpi_op_commutative_f,
|
||||
(MPI_Fint *op, MPI_Fint *commute, MPI_Fint *ierr),
|
||||
(op, commute, ierr) )
|
||||
#endif
|
||||
|
||||
#if OPAL_HAVE_WEAK_SYMBOLS
|
||||
#pragma weak MPI_OP_COMMUTATIVE = mpi_op_commutative_f
|
||||
#pragma weak mpi_op_commutative = mpi_op_commutative_f
|
||||
#pragma weak mpi_op_commutative_ = mpi_op_commutative_f
|
||||
#pragma weak mpi_op_commutative__ = mpi_op_commutative_f
|
||||
#endif
|
||||
|
||||
#if ! OPAL_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
|
||||
OMPI_GENERATE_F77_BINDINGS (MPI_OP_COMMUTATIVE,
|
||||
mpi_op_commutative,
|
||||
mpi_op_commutative_,
|
||||
mpi_op_commutative__,
|
||||
mpi_op_commutative_f,
|
||||
(MPI_Fint *op, MPI_Fint *commute, MPI_Fint *ierr),
|
||||
(op, commute, ierr) )
|
||||
#endif
|
||||
|
||||
|
||||
#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
|
||||
#include "ompi/mpi/f77/profile/defines.h"
|
||||
#endif
|
||||
|
||||
void mpi_op_commutative_f(MPI_Fint *op, MPI_Fint *commute, MPI_Fint *ierr)
|
||||
{
|
||||
MPI_Op c_op;
|
||||
OMPI_SINGLE_NAME_DECL(commute);
|
||||
|
||||
c_op = MPI_Op_f2c(*op);
|
||||
|
||||
*ierr = OMPI_INT_2_FINT(MPI_op_commutative(c_op,
|
||||
OMPI_SINGLE_NAME_CONVERT(commute));
|
||||
if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
|
||||
OMPI_SINGLE_INT_2_FINT(commute);
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
@ -10,6 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -198,6 +198,7 @@
|
||||
#define mpi_keyval_create_f pmpi_keyval_create_f
|
||||
#define mpi_keyval_free_f pmpi_keyval_free_f
|
||||
#define mpi_lookup_name_f pmpi_lookup_name_f
|
||||
#define mpi_op_commutative_f pmpi_op_commutative_f
|
||||
#define mpi_op_create_f pmpi_op_create_f
|
||||
#define mpi_open_port_f pmpi_open_port_f
|
||||
#define mpi_op_free_f pmpi_op_free_f
|
||||
|
@ -241,6 +241,7 @@ PN(void, mpi_is_thread_main, MPI_IS_THREAD_MAIN, (ompi_fortran_logical_t *flag,
|
||||
PN(void, mpi_keyval_create, MPI_KEYVAL_CREATE, (ompi_mpi1_fortran_copy_attr_function* copy_fn, ompi_mpi1_fortran_delete_attr_function* delete_fn, MPI_Fint *keyval, MPI_Fint *extra_state, MPI_Fint *ierr));
|
||||
PN(void, mpi_keyval_free, MPI_KEYVAL_FREE, (MPI_Fint *keyval, MPI_Fint *ierr));
|
||||
PN(void, mpi_lookup_name, MPI_LOOKUP_NAME, (char *service_name, MPI_Fint *info, char *port_name, MPI_Fint *ierr, int service_name_len, int port_name_len));
|
||||
PN(void, mpi_op_commutative, MPI_OP_COMMUTATIVE, (MPI_Fint *op, MPI_Fint *commute, MPI_Fint *ierr));
|
||||
PN(void, mpi_op_create, MPI_OP_CREATE, (ompi_op_fortran_handler_fn_t* function, ompi_fortran_logical_t *commute, MPI_Fint *op, MPI_Fint *ierr));
|
||||
PN(void, mpi_open_port, MPI_OPEN_PORT, (MPI_Fint *info, char *port_name, MPI_Fint *ierr, int port_name_len));
|
||||
PN(void, mpi_op_free, MPI_OP_FREE, (MPI_Fint *op, MPI_Fint *ierr));
|
||||
|
@ -5912,6 +5912,29 @@ end MPI_Keyval_free
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
output_171_commutative() {
|
||||
if test "$output" = "0"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
procedure=$1
|
||||
cat <<EOF
|
||||
|
||||
subroutine ${procedure}(op, commute, ierr)
|
||||
integer, intent(in) :: op
|
||||
logical, intent(out) :: commute
|
||||
integer, intent(out) :: ierr
|
||||
end subroutine ${procedure}
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
start MPI_Op_commutative small
|
||||
output_171_commutative MPI_Op_commutative
|
||||
end MPI_Op_commutative
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
output_171() {
|
||||
if test "$output" = "0"; then
|
||||
return 0
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user