Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MPI3 changed MPI interface to use const everywhere it could.
authordegomme <adegomme@users.noreply.github.com>
Fri, 26 Apr 2019 09:30:56 +0000 (11:30 +0200)
committerdegomme <adegomme@users.noreply.github.com>
Fri, 26 Apr 2019 09:42:18 +0000 (11:42 +0200)
Start with MPI_Info_*

include/smpi/smpi.h
src/smpi/bindings/smpi_mpi.cpp
src/smpi/bindings/smpi_pmpi_info.cpp
src/smpi/include/smpi_info.hpp
src/smpi/mpi/smpi_info.cpp

index 6c4ea8d..1e1baf8 100644 (file)
@@ -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_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_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_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));
 
 MPI_CALL(XBT_PUBLIC MPI_Info, MPI_Info_f2c, (MPI_Fint info));
 MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Info_c2f, (MPI_Info info));
 
index 03ae86b..5ee0555 100644 (file)
@@ -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_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_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_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))
 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))
index f9fb0c2..ca08ebf 100644 (file)
@@ -17,7 +17,7 @@ int PMPI_Info_create( MPI_Info *info){
   return MPI_SUCCESS;
 }
 
   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);
   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;
 }
 
   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;
   *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;
 }
 
   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);
   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);
 }
 
   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;
   *flag=false;
   if (info == nullptr || key == nullptr || valuelen==nullptr)
     return MPI_ERR_ARG;
index 01062cc..1fb206a 100644 (file)
@@ -25,12 +25,12 @@ public:
   ~Info() = default;
   void ref();
   static void unref(MPI_Info info);
   ~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_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);
 };
 
   static Info* f2c(int id);
 };
 
index 7b3efad..73a323e 100644 (file)
@@ -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()) {
   *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
   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;
 }
 
   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()) {
   *flag=false;
   auto val = map_.find(key);
   if (val != map_.end()) {