]> AND Public Git Repository - simgrid.git/blobdiff - src/smpi/bindings/smpi_pmpi_comm.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move the simcall template to the kernel::actor namespace
[simgrid.git] / src / smpi / bindings / smpi_pmpi_comm.cpp
index 7291ed2caec437ff6feef1a26f38392354337722..cc7550341241d9babd1184ca3bbc04d303777c5e 100644 (file)
@@ -217,10 +217,14 @@ int PMPI_Comm_create_group(MPI_Comm comm, MPI_Group group, int, MPI_Comm* comm_o
 }
 
 MPI_Comm PMPI_Comm_f2c(MPI_Fint comm){
+  if(comm==-1)
+    return MPI_COMM_NULL;
   return static_cast<MPI_Comm>(simgrid::smpi::Comm::f2c(comm));
 }
 
 MPI_Fint PMPI_Comm_c2f(MPI_Comm comm){
+  if(comm==MPI_COMM_NULL)
+    return -1;
   return comm->c2f();
 }
 
@@ -284,6 +288,7 @@ int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
   static int zero = 0;
   static int tag_ub = INT_MAX;
   static int last_used_code = MPI_ERR_LASTCODE;
+  static int universe_size;
 
   if (comm==MPI_COMM_NULL){
     *flag = 0;
@@ -299,7 +304,8 @@ int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
     return MPI_SUCCESS;
   case MPI_UNIVERSE_SIZE:
     *flag = 1;
-    *static_cast<int**>(attr_value) = &smpi_universe_size;
+    universe_size                   = smpi_get_universe_size();
+    *static_cast<int**>(attr_value) = &universe_size;
     return MPI_SUCCESS;
   case MPI_LASTUSEDCODE:
     *flag = 1;