Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't return an error when a key is not found in an MPI_Info.
authorAugustin Degomme <adegomme@users.noreply.github.com>
Sun, 18 Aug 2019 21:33:50 +0000 (23:33 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Sun, 18 Aug 2019 21:33:50 +0000 (23:33 +0200)
src/smpi/bindings/smpi_pmpi_info.cpp
src/smpi/internals/smpi_actor.cpp
src/smpi/mpi/smpi_info.cpp

index 82634cf..0a694f2 100644 (file)
@@ -34,8 +34,10 @@ int PMPI_Info_free( MPI_Info *info){
 
 int PMPI_Info_get(MPI_Info info, const char *key,int valuelen, char *value, int *flag){
   *flag=false;
 
 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)
+  if (info == nullptr || valuelen <0)
     return MPI_ERR_ARG;
     return MPI_ERR_ARG;
+  if (key == nullptr)
+    return MPI_ERR_INFO_KEY;
   if (value == nullptr)
     return MPI_ERR_INFO_VALUE;
   return info->get(key, valuelen, value, flag);
   if (value == nullptr)
     return MPI_ERR_INFO_VALUE;
   return info->get(key, valuelen, value, flag);
@@ -68,8 +70,12 @@ int PMPI_Info_get_nthkey( MPI_Info info, int n, char *key){
 
 int PMPI_Info_get_valuelen( MPI_Info info, const char *key, int *valuelen, int *flag){
   *flag=false;
 
 int PMPI_Info_get_valuelen( MPI_Info info, const char *key, int *valuelen, int *flag){
   *flag=false;
-  if (info == nullptr || key == nullptr || valuelen==nullptr)
+  if (info == nullptr)
     return MPI_ERR_ARG;
     return MPI_ERR_ARG;
+  if (key == nullptr)
+    return MPI_ERR_INFO_KEY;
+  if (valuelen == nullptr)
+    return MPI_ERR_INFO_VALUE;
   return info->get_valuelen(key, valuelen, flag);
 }
 
   return info->get_valuelen(key, valuelen, flag);
 }
 
index bb5d5af..c918f1a 100644 (file)
@@ -6,6 +6,7 @@
 #include "src/smpi/include/smpi_actor.hpp"
 #include "mc/mc.h"
 #include "smpi_comm.hpp"
 #include "src/smpi/include/smpi_actor.hpp"
 #include "mc/mc.h"
 #include "smpi_comm.hpp"
+#include "smpi_info.hpp"
 #include "src/mc/mc_replay.hpp"
 #include "src/simix/smx_private.hpp"
 
 #include "src/mc/mc_replay.hpp"
 #include "src/simix/smx_private.hpp"
 
@@ -180,6 +181,8 @@ MPI_Comm ActorExt::comm_self()
 
 MPI_Info ActorExt::info_env()
 {
 
 MPI_Info ActorExt::info_env()
 {
+  if (info_env_==MPI_INFO_NULL)
+    info_env_=new Info();
   return info_env_;
 }
 
   return info_env_;
 }
 
index 73a323e..c20ae58 100644 (file)
@@ -31,10 +31,8 @@ int Info::get(const char *key, int valuelen, char *value, int *flag){
     memcpy(value, tmpvalue.c_str(),
            (tmpvalue.length() + 1 < static_cast<size_t>(valuelen)) ? tmpvalue.length() + 1 : valuelen);
     *flag=true;
     memcpy(value, tmpvalue.c_str(),
            (tmpvalue.length() + 1 < static_cast<size_t>(valuelen)) ? tmpvalue.length() + 1 : valuelen);
     *flag=true;
-    return MPI_SUCCESS;
-  } else {
-    return MPI_ERR_INFO_KEY;
   }
   }
+  return MPI_SUCCESS;
 }
 
 int Info::remove(const char *key){
 }
 
 int Info::remove(const char *key){
@@ -67,10 +65,8 @@ int Info::get_valuelen(const char *key, int *valuelen, int *flag){
   if (val != map_.end()) {
     *valuelen = val->second.length();
     *flag=true;
   if (val != map_.end()) {
     *valuelen = val->second.length();
     *flag=true;
-    return MPI_SUCCESS;
-  } else {
-    return MPI_ERR_INFO_KEY;
   }
   }
+  return MPI_SUCCESS;
 }
 
 Info* Info::f2c(int id){
 }
 
 Info* Info::f2c(int id){