From: degomme Date: Sun, 26 Mar 2017 20:48:14 +0000 (+0200) Subject: support MPI_Op_commutative call, as it was already implemented internally X-Git-Tag: v3.16~434 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a9c9083479c7a98cb890faad9d2f40e9a64ccd83?hp=0374ac8966d889dcae39e21787cf93c9530c41e8 support MPI_Op_commutative call, as it was already implemented internally --- diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index c57139b8ed..d7421ac301 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -440,6 +440,7 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Type_contiguous, (int count, MPI_Datatype old_type MPI_CALL(XBT_PUBLIC(int), MPI_Testall, (int count, MPI_Request* requests, int* flag, MPI_Status* statuses)); MPI_CALL(XBT_PUBLIC(int), MPI_Op_create, (MPI_User_function * function, int commute, MPI_Op * op)); MPI_CALL(XBT_PUBLIC(int), MPI_Op_free, (MPI_Op * op)); +MPI_CALL(XBT_PUBLIC(int), MPI_Op_commutative, (MPI_Op op, int *commute)); MPI_CALL(XBT_PUBLIC(int), MPI_Group_free, (MPI_Group * group)); MPI_CALL(XBT_PUBLIC(int), MPI_Group_size, (MPI_Group group, int *size)); diff --git a/src/smpi/smpi_mpi.cpp b/src/smpi/smpi_mpi.cpp index 3099f4f80f..a2cc22a3ac 100644 --- a/src/smpi/smpi_mpi.cpp +++ b/src/smpi/smpi_mpi.cpp @@ -119,6 +119,7 @@ WRAPPED_PMPI_CALL(int,MPI_Keyval_create,(MPI_Copy_function* copy_fn, MPI_Delete_ WRAPPED_PMPI_CALL(int,MPI_Keyval_free,(int* keyval) ,(keyval)) WRAPPED_PMPI_CALL(int,MPI_Op_create,(MPI_User_function * function, int commute, MPI_Op * op),(function, commute, op)) WRAPPED_PMPI_CALL(int,MPI_Op_free,(MPI_Op * op),(op)) +WRAPPED_PMPI_CALL(int,MPI_Op_commutative,(MPI_Op op, int *commute), (op, commute)) WRAPPED_PMPI_CALL(int,MPI_Pack_size,(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) ,(incount, datatype, comm, size)) WRAPPED_PMPI_CALL(int,MPI_Pack,(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) ,(inbuf, incount, type, outbuf, outcount, position, comm)) WRAPPED_PMPI_CALL(int,MPI_Probe,(int source, int tag, MPI_Comm comm, MPI_Status* status) ,(source, tag, comm, status)) diff --git a/src/smpi/smpi_pmpi.cpp b/src/smpi/smpi_pmpi.cpp index d14354c73e..64ff2a350d 100644 --- a/src/smpi/smpi_pmpi.cpp +++ b/src/smpi/smpi_pmpi.cpp @@ -270,6 +270,17 @@ int PMPI_Op_free(MPI_Op * op) } } +int PMPI_Op_commutative(MPI_Op op, int* commute){ + if (op == MPI_OP_NULL) { + return MPI_ERR_OP; + } else if (commute==nullptr){ + return MPI_ERR_ARG; + } else { + *commute = op->is_commutative(); + return MPI_SUCCESS; + } +} + int PMPI_Group_free(MPI_Group * group) { if (group == nullptr) { diff --git a/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt b/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt index 5a82de547a..4ead9de0e1 100644 --- a/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt @@ -80,7 +80,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) # add_executable(opband opband.c) # add_executable(opbor opbor.c) # add_executable(opbxor opbxor.c) -# add_executable(op_commutative op_commutative.c) + add_executable(op_commutative op_commutative.c) # add_executable(opland opland.c) # add_executable(oplor oplor.c) # add_executable(oplxor oplxor.c) @@ -172,7 +172,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) # target_link_libraries(opband simgrid mtest_c) # target_link_libraries(opbor simgrid mtest_c) # target_link_libraries(opbxor simgrid mtest_c) -# target_link_libraries(op_commutative simgrid mtest_c) + target_link_libraries(op_commutative simgrid mtest_c) # target_link_libraries(opland simgrid mtest_c) # target_link_libraries(oplor simgrid mtest_c) # target_link_libraries(oplxor simgrid mtest_c) diff --git a/teshsuite/smpi/mpich3-test/coll/testlist b/teshsuite/smpi/mpich3-test/coll/testlist index a3ac761539..6158b7a2f9 100644 --- a/teshsuite/smpi/mpich3-test/coll/testlist +++ b/teshsuite/smpi/mpich3-test/coll/testlist @@ -12,7 +12,7 @@ allred6 7 reduce_mpich 5 reduce_mpich 10 reduce_local 2 mpiversion=2.2 -#op_commutative 2 +op_commutative 2 red3 10 red4 10 alltoall1 8