From fc8861150343f581a82f22316bc4b619b499ca7b Mon Sep 17 00:00:00 2001 From: degomme Date: Fri, 26 Apr 2019 11:30:56 +0200 Subject: [PATCH] MPI3 changed MPI interface to use const everywhere it could. Start with MPI_Info_* --- include/smpi/smpi.h | 8 ++++---- src/smpi/bindings/smpi_mpi.cpp | 8 ++++---- src/smpi/bindings/smpi_pmpi_info.cpp | 8 ++++---- src/smpi/include/smpi_info.hpp | 8 ++++---- src/smpi/mpi/smpi_info.cpp | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 6c4ea8d4ac..1e1baf8ea3 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -637,14 +637,14 @@ MPI_CALL(XBT_PUBLIC int, MPI_Alltoallw, MPI_CALL(XBT_PUBLIC int, MPI_Reduce_local, (void* inbuf, void* inoutbuf, int count, MPI_Datatype datatype, MPI_Op op)); MPI_CALL(XBT_PUBLIC int, MPI_Info_create, (MPI_Info * info)); -MPI_CALL(XBT_PUBLIC int, MPI_Info_set, (MPI_Info info, char* key, char* value)); -MPI_CALL(XBT_PUBLIC int, MPI_Info_get, (MPI_Info info, char* key, int valuelen, char* value, int* flag)); +MPI_CALL(XBT_PUBLIC int, MPI_Info_set, (MPI_Info info, const char* key, const char* value)); +MPI_CALL(XBT_PUBLIC int, MPI_Info_get, (MPI_Info info, const char* key, int valuelen, char* value, int* flag)); MPI_CALL(XBT_PUBLIC int, MPI_Info_free, (MPI_Info * info)); -MPI_CALL(XBT_PUBLIC int, MPI_Info_delete, (MPI_Info info, char* key)); +MPI_CALL(XBT_PUBLIC int, MPI_Info_delete, (MPI_Info info, const char* key)); MPI_CALL(XBT_PUBLIC int, MPI_Info_dup, (MPI_Info info, MPI_Info* newinfo)); MPI_CALL(XBT_PUBLIC int, MPI_Info_get_nkeys, (MPI_Info info, int* nkeys)); MPI_CALL(XBT_PUBLIC int, MPI_Info_get_nthkey, (MPI_Info info, int n, char* key)); -MPI_CALL(XBT_PUBLIC int, MPI_Info_get_valuelen, (MPI_Info info, char* key, int* valuelen, int* flag)); +MPI_CALL(XBT_PUBLIC int, MPI_Info_get_valuelen, (MPI_Info info, const char* key, int* valuelen, int* flag)); MPI_CALL(XBT_PUBLIC MPI_Info, MPI_Info_f2c, (MPI_Fint info)); MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Info_c2f, (MPI_Info info)); diff --git a/src/smpi/bindings/smpi_mpi.cpp b/src/smpi/bindings/smpi_mpi.cpp index 03ae86b85a..5ee0555526 100644 --- a/src/smpi/bindings/smpi_mpi.cpp +++ b/src/smpi/bindings/smpi_mpi.cpp @@ -164,14 +164,14 @@ WRAPPED_PMPI_CALL(int,MPI_Iscatter,(void *sendbuf, int sendcount, MPI_Datatype s WRAPPED_PMPI_CALL(int,MPI_Iscatterv,(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount,MPI_Datatype recvtype, int root, MPI_Comm comm, MPI_Request *request),(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, request)) WRAPPED_PMPI_CALL(int,MPI_Info_create,( MPI_Info *info),( info)) -WRAPPED_PMPI_CALL(int,MPI_Info_delete,(MPI_Info info, char *key),(info, key)) +WRAPPED_PMPI_CALL(int,MPI_Info_delete,(MPI_Info info, const char *key),(info, key)) WRAPPED_PMPI_CALL(int,MPI_Info_dup,(MPI_Info info, MPI_Info *newinfo),(info, newinfo)) WRAPPED_PMPI_CALL(int,MPI_Info_free,( MPI_Info *info),( info)) -WRAPPED_PMPI_CALL(int,MPI_Info_get,(MPI_Info info,char *key,int valuelen, char *value, int *flag),(info,key,valuelen, value, flag)) +WRAPPED_PMPI_CALL(int,MPI_Info_get,(MPI_Info info,const char *key,int valuelen, char *value, int *flag),(info,key,valuelen, value, flag)) WRAPPED_PMPI_CALL(int,MPI_Info_get_nkeys,( MPI_Info info, int *nkeys),(info, nkeys)) WRAPPED_PMPI_CALL(int,MPI_Info_get_nthkey,( MPI_Info info, int n, char *key),( info, n, key)) -WRAPPED_PMPI_CALL(int,MPI_Info_get_valuelen,( MPI_Info info, char *key, int *valuelen, int *flag),( info, key, valuelen, flag)) -WRAPPED_PMPI_CALL(int,MPI_Info_set,( MPI_Info info, char *key, char *value),( info, key, value)) +WRAPPED_PMPI_CALL(int,MPI_Info_get_valuelen,( MPI_Info info, const char *key, int *valuelen, int *flag),( info, key, valuelen, flag)) +WRAPPED_PMPI_CALL(int,MPI_Info_set,( MPI_Info info, const char *key, const char *value),( info, key, value)) WRAPPED_PMPI_CALL(int,MPI_Initialized,(int* flag) ,(flag)) WRAPPED_PMPI_CALL(int,MPI_Init,(int *argc, char ***argv),(argc, argv)) WRAPPED_PMPI_CALL(int,MPI_Init_thread,(int *argc, char ***argv, int required, int *provided),(argc, argv, required, provided)) diff --git a/src/smpi/bindings/smpi_pmpi_info.cpp b/src/smpi/bindings/smpi_pmpi_info.cpp index f9fb0c2e9e..ca08ebf6e5 100644 --- a/src/smpi/bindings/smpi_pmpi_info.cpp +++ b/src/smpi/bindings/smpi_pmpi_info.cpp @@ -17,7 +17,7 @@ int PMPI_Info_create( MPI_Info *info){ return MPI_SUCCESS; } -int PMPI_Info_set( MPI_Info info, char *key, char *value){ +int PMPI_Info_set( MPI_Info info, const char *key, const char *value){ if (info == nullptr || key == nullptr || value == nullptr) return MPI_ERR_ARG; info->set(key, value); @@ -32,7 +32,7 @@ int PMPI_Info_free( MPI_Info *info){ return MPI_SUCCESS; } -int PMPI_Info_get(MPI_Info info,char *key,int valuelen, char *value, int *flag){ +int PMPI_Info_get(MPI_Info info, const char *key,int valuelen, char *value, int *flag){ *flag=false; if (info == nullptr || key == nullptr || valuelen <0) return MPI_ERR_ARG; @@ -48,7 +48,7 @@ int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo){ return MPI_SUCCESS; } -int PMPI_Info_delete(MPI_Info info, char *key){ +int PMPI_Info_delete(MPI_Info info, const char *key){ if (info == nullptr || key==nullptr) return MPI_ERR_ARG; return info->remove(key); @@ -66,7 +66,7 @@ int PMPI_Info_get_nthkey( MPI_Info info, int n, char *key){ return info->get_nthkey(n, key); } -int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){ +int PMPI_Info_get_valuelen( MPI_Info info, const char *key, int *valuelen, int *flag){ *flag=false; if (info == nullptr || key == nullptr || valuelen==nullptr) return MPI_ERR_ARG; diff --git a/src/smpi/include/smpi_info.hpp b/src/smpi/include/smpi_info.hpp index 01062cc31b..1fb206ab03 100644 --- a/src/smpi/include/smpi_info.hpp +++ b/src/smpi/include/smpi_info.hpp @@ -25,12 +25,12 @@ public: ~Info() = default; void ref(); static void unref(MPI_Info info); - void set(char* key, char* value) { map_[key] = value; } - int get(char* key, int valuelen, char* value, int* flag); - int remove(char* key); + void set(const char* key, const char* value) { map_[key] = value; } + int get(const char* key, int valuelen, char* value, int* flag); + int remove(const char* key); int get_nkeys(int* nkeys); int get_nthkey(int n, char* key); - int get_valuelen(char* key, int* valuelen, int* flag); + int get_valuelen(const char* key, int* valuelen, int* flag); static Info* f2c(int id); }; diff --git a/src/smpi/mpi/smpi_info.cpp b/src/smpi/mpi/smpi_info.cpp index 7b3efad28c..73a323e7b9 100644 --- a/src/smpi/mpi/smpi_info.cpp +++ b/src/smpi/mpi/smpi_info.cpp @@ -21,7 +21,7 @@ void Info::unref(Info* info){ } } -int Info::get(char *key, int valuelen, char *value, int *flag){ +int Info::get(const char *key, int valuelen, char *value, int *flag){ *flag=false; auto val = map_.find(key); if (val != map_.end()) { @@ -37,7 +37,7 @@ int Info::get(char *key, int valuelen, char *value, int *flag){ } } -int Info::remove(char *key){ +int Info::remove(const char *key){ if (map_.erase(key) == 0) return MPI_ERR_INFO_NOKEY; else @@ -61,7 +61,7 @@ int Info::get_nthkey(int n, char *key){ return MPI_ERR_ARG; } -int Info::get_valuelen(char *key, int *valuelen, int *flag){ +int Info::get_valuelen(const char *key, int *valuelen, int *flag){ *flag=false; auto val = map_.find(key); if (val != map_.end()) { -- 2.20.1