Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix some issues with groups
authorAugustin Degomme <adegomme@users.noreply.github.com>
Fri, 19 Feb 2021 07:54:39 +0000 (08:54 +0100)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Fri, 19 Feb 2021 07:54:39 +0000 (08:54 +0100)
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_group.cpp

index 5bcb35e..6ed5725 100644 (file)
@@ -35,7 +35,7 @@ Comm::Comm(MPI_Group group, MPI_Topology topo, bool smp, int in_id)
   //First creation of comm is done before SIMIX_run, so only do comms for others
   if(in_id==MPI_UNDEFINED && smp==0 && this->rank()!=MPI_UNDEFINED ){
     this->add_f();
-    group->add_f();
+    group->c2f();
     int id;
     if(this->rank()==0){
       static int global_id_ = 0;
index 977b1c4..63403f0 100644 (file)
@@ -121,7 +121,8 @@ int Group::incl(int n, const int* ranks, MPI_Group* newgroup)
       s4u::Actor* actor = this->actor(ranks[i]); // ranks[] was passed as a param!
       (*newgroup)->set_mapping(actor, i);
     }
-    (*newgroup)->add_f();
+    if((*newgroup)!=MPI_GROUP_EMPTY)
+      (*newgroup)->add_f();
   }
   return MPI_SUCCESS;
 }
@@ -150,7 +151,8 @@ int Group::group_union(MPI_Group group2, MPI_Group* newgroup)
       s4u::Actor* actor = group2->actor(i - size2);
       (*newgroup)->set_mapping(actor, i);
     }
-    (*newgroup)->add_f();
+    if((*newgroup)!=MPI_GROUP_EMPTY)
+      (*newgroup)->add_f();
   }
   return MPI_SUCCESS;
 }
@@ -177,8 +179,9 @@ int Group::intersection(MPI_Group group2, MPI_Group* newgroup)
         (*newgroup)->set_mapping(actor, j);
         j++;
       }
-      (*newgroup)->add_f();
     }
+    if((*newgroup)!=MPI_GROUP_EMPTY)
+      (*newgroup)->add_f();
   }
   return MPI_SUCCESS;
 }
@@ -205,7 +208,8 @@ int Group::difference(MPI_Group group2, MPI_Group* newgroup)
         (*newgroup)->set_mapping(actor, i);
       }
     }
-    (*newgroup)->add_f();
+    if((*newgroup)!=MPI_GROUP_EMPTY)
+      (*newgroup)->add_f();
   }
   return MPI_SUCCESS;
 }
@@ -225,7 +229,8 @@ int Group::excl(int n, const int *ranks, MPI_Group * newgroup){
       j++;
     }
   }
-  (*newgroup)->add_f();
+  if((*newgroup)!=MPI_GROUP_EMPTY)
+    (*newgroup)->add_f();
   return MPI_SUCCESS;
 }
 
@@ -269,7 +274,8 @@ int Group::range_incl(int n, int ranges[][3], MPI_Group * newgroup){
         break;
     }
   }
-  (*newgroup)->add_f();
+  if((*newgroup)!=MPI_GROUP_EMPTY)
+    (*newgroup)->add_f();
   return MPI_SUCCESS;
 }
 
@@ -318,7 +324,8 @@ int Group::range_excl(int n, int ranges[][3], MPI_Group * newgroup){
       oldrank++;
     }
   }
-  (*newgroup)->add_f();
+  if((*newgroup)!=MPI_GROUP_EMPTY)
+    (*newgroup)->add_f();
   return MPI_SUCCESS;
 }