From cf507642628052d29599e6b7703e049ef28c0505 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Sun, 14 Apr 2019 16:08:37 +0200 Subject: [PATCH] MPI_Comm_get_info, MPI_Comm_set_info --- src/smpi/bindings/smpi_mpi.cpp | 4 ++-- src/smpi/bindings/smpi_pmpi_comm.cpp | 20 ++++++++++++++++++++ src/smpi/include/smpi_comm.hpp | 3 +++ src/smpi/mpi/smpi_comm.cpp | 14 ++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/smpi/bindings/smpi_mpi.cpp b/src/smpi/bindings/smpi_mpi.cpp index e398d05931..3a354e0fc8 100644 --- a/src/smpi/bindings/smpi_mpi.cpp +++ b/src/smpi/bindings/smpi_mpi.cpp @@ -102,11 +102,13 @@ WRAPPED_PMPI_CALL(int,MPI_Comm_dup,(MPI_Comm comm, MPI_Comm * newcomm),(comm, ne WRAPPED_PMPI_CALL(int,MPI_Comm_free_keyval,(int* keyval) ,( keyval)) WRAPPED_PMPI_CALL(int,MPI_Comm_free,(MPI_Comm * comm),(comm)) WRAPPED_PMPI_CALL(int,MPI_Comm_get_attr ,(MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag),(comm, comm_keyval, attribute_val, flag)) +WRAPPED_PMPI_CALL(int,MPI_Comm_get_info ,(MPI_Comm comm, MPI_Info* info),(comm, info)) WRAPPED_PMPI_CALL(int,MPI_Comm_get_name ,(MPI_Comm comm, char* name, int* len),(comm, name, len)) WRAPPED_PMPI_CALL(int,MPI_Comm_set_name ,(MPI_Comm comm, char* name),(comm, name)) WRAPPED_PMPI_CALL(int,MPI_Comm_group,(MPI_Comm comm, MPI_Group * group),(comm, group)) WRAPPED_PMPI_CALL(int,MPI_Comm_rank,(MPI_Comm comm, int *rank),(comm, rank)) WRAPPED_PMPI_CALL(int,MPI_Comm_set_attr ,(MPI_Comm comm, int comm_keyval, void *attribute_val),( comm, comm_keyval, attribute_val)) +WRAPPED_PMPI_CALL(int,MPI_Comm_set_info ,(MPI_Comm comm, MPI_Info info),(comm, info)) WRAPPED_PMPI_CALL(int,MPI_Comm_size,(MPI_Comm comm, int *size),(comm, size)) WRAPPED_PMPI_CALL(int,MPI_Comm_split,(MPI_Comm comm, int color, int key, MPI_Comm* comm_out),(comm, color, key, comm_out)) WRAPPED_PMPI_CALL(int,MPI_Comm_split_type,(MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm *newcomm),(comm, split_type, key, info, newcomm)) @@ -325,13 +327,11 @@ UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_connect,( char *port_name, MPI_Info UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_create_errhandler,( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler),( function, errhandler)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_dup_with_info,(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm),(comm,info,newcomm)) UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_get_errhandler,(MPI_Comm comm, MPI_Errhandler* errhandler) ,(comm, errhandler)) -UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_get_info ,(MPI_Comm comm, MPI_Info* info),(comm, info)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_get_parent,( MPI_Comm *parent),( parent)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_join,( int fd, MPI_Comm *intercomm),( fd, intercomm)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_remote_group,(MPI_Comm comm, MPI_Group* group) ,(comm, group)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_remote_size,(MPI_Comm comm, int* size) ,(comm, size)) UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_set_errhandler,(MPI_Comm comm, MPI_Errhandler errhandler) ,(comm, errhandler)) -UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_set_info ,(MPI_Comm comm, MPI_Info info),(comm, info)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn,( char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes),( command, argv, maxprocs, info, root, comm, intercomm, array_of_errcodes)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn_multiple,(int count, char **array_of_commands, char*** array_of_argv, int* array_of_maxprocs, MPI_Info* array_of_info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes), (count, array_of_commands, array_of_argv, array_of_maxprocs, array_of_info, root, comm, intercomm, array_of_errcodes)) UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_test_inter,(MPI_Comm comm, int* flag) ,(comm, flag)) diff --git a/src/smpi/bindings/smpi_pmpi_comm.cpp b/src/smpi/bindings/smpi_pmpi_comm.cpp index 07a290470d..204207d6fd 100644 --- a/src/smpi/bindings/smpi_pmpi_comm.cpp +++ b/src/smpi/bindings/smpi_pmpi_comm.cpp @@ -221,6 +221,26 @@ int PMPI_Comm_set_attr (MPI_Comm comm, int comm_keyval, void *attribute_val) return PMPI_Attr_put(comm, comm_keyval, attribute_val); } +int PMPI_Comm_get_info(MPI_Comm comm, MPI_Info* info) +{ + if (comm == MPI_COMM_NULL) { + return MPI_ERR_WIN; + } else { + *info = comm->info(); + return MPI_SUCCESS; + } +} + +int PMPI_Comm_set_info(MPI_Comm comm, MPI_Info info) +{ + if (comm == MPI_COMM_NULL) { + return MPI_ERR_TYPE; + } else { + comm->set_info(info); + return MPI_SUCCESS; + } +} + int PMPI_Comm_delete_attr (MPI_Comm comm, int comm_keyval) { return PMPI_Attr_delete(comm, comm_keyval); diff --git a/src/smpi/include/smpi_comm.hpp b/src/smpi/include/smpi_comm.hpp index e6bba6d61d..3d0077335a 100644 --- a/src/smpi/include/smpi_comm.hpp +++ b/src/smpi/include/smpi_comm.hpp @@ -30,6 +30,7 @@ class Comm : public F2C, public Keyval{ int is_smp_comm_; // set to 0 in case this is already an intra-comm or a leader-comm to avoid recursivity std::list rma_wins_; // attached windows for synchronization. std::string name_; + MPI_Info info_; public: static std::unordered_map keyvals_; @@ -44,6 +45,8 @@ public: int rank(); void get_name(char* name, int* len); void set_name(char* name); + MPI_Info info(); + void set_info( MPI_Info info); void set_leaders_comm(MPI_Comm leaders); void set_intra_comm(MPI_Comm leaders) { intra_comm_ = leaders; }; int* get_non_uniform_map(); diff --git a/src/smpi/mpi/smpi_comm.cpp b/src/smpi/mpi/smpi_comm.cpp index 92d2f499fe..7722473d21 100644 --- a/src/smpi/mpi/smpi_comm.cpp +++ b/src/smpi/mpi/smpi_comm.cpp @@ -8,6 +8,7 @@ #include "smpi_datatype.hpp" #include "smpi_request.hpp" #include "smpi_win.hpp" +#include "smpi_info.hpp" #include "src/smpi/include/smpi_actor.hpp" #include "src/surf/HostImpl.hpp" @@ -503,6 +504,19 @@ void Comm::finish_rma_calls(){ } } +MPI_Info Comm::info(){ + if(info_== MPI_INFO_NULL) + info_ = new Info(); + info_->ref(); + return info_; +} + +void Comm::set_info(MPI_Info info){ + if(info_!= MPI_INFO_NULL) + info->ref(); + info_=info; +} + MPI_Comm Comm::split_type(int type, int key, MPI_Info info) { if(type != MPI_COMM_TYPE_SHARED){ -- 2.20.1