Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
There's no more need for ActorPtr there.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 26 Sep 2019 07:51:52 +0000 (09:51 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 26 Sep 2019 07:51:52 +0000 (09:51 +0200)
src/smpi/bindings/smpi_pmpi_group.cpp
src/smpi/include/private.hpp
src/smpi/include/smpi_group.hpp
src/smpi/internals/smpi_actor.cpp
src/smpi/internals/smpi_deployment.cpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_group.cpp

index 83b08ed..e038ca7 100644 (file)
@@ -59,7 +59,7 @@ int PMPI_Group_translate_ranks(MPI_Group group1, int n, const int *ranks1, MPI_G
       if(ranks1[i]==MPI_PROC_NULL){
         ranks2[i]=MPI_PROC_NULL;
       }else{
       if(ranks1[i]==MPI_PROC_NULL){
         ranks2[i]=MPI_PROC_NULL;
       }else{
-        simgrid::s4u::ActorPtr actor = group1->actor(ranks1[i]);
+        simgrid::s4u::Actor* actor = group1->actor(ranks1[i]);
         ranks2[i] = group2->rank(actor);
       }
     }
         ranks2[i] = group2->rank(actor);
       }
     }
index b3bec46..01e5727 100644 (file)
@@ -76,8 +76,7 @@ XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process();
 XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor);
 XBT_PRIVATE int smpi_get_universe_size();
 
 XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor);
 XBT_PRIVATE int smpi_get_universe_size();
 
-XBT_PRIVATE void smpi_deployment_register_process(const std::string& instance_id, int rank,
-                                                  simgrid::s4u::ActorPtr actor);
+XBT_PRIVATE void smpi_deployment_register_process(const std::string& instance_id, int rank, simgrid::s4u::Actor* actor);
 XBT_PRIVATE void smpi_deployment_unregister_process(const std::string& instance_id);
 
 XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const std::string& instance_id);
 XBT_PRIVATE void smpi_deployment_unregister_process(const std::string& instance_id);
 
 XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const std::string& instance_id);
index 9607843..c0fa3fe 100644 (file)
@@ -30,10 +30,10 @@ public:
   explicit Group(int size) : size_(size), rank_to_actor_map_(size, nullptr), index_to_rank_map_(size, MPI_UNDEFINED) {}
   explicit Group(Group* origin);
 
   explicit Group(int size) : size_(size), rank_to_actor_map_(size, nullptr), index_to_rank_map_(size, MPI_UNDEFINED) {}
   explicit Group(Group* origin);
 
-  void set_mapping(s4u::ActorPtr actor, int rank);
+  void set_mapping(s4u::Actor* actor, int rank);
   int rank(int index);
   int rank(int index);
-  s4u::ActorPtr actor(int rank);
-  int rank(s4u::ActorPtr process);
+  s4u::Actor* actor(int rank);
+  int rank(s4u::Actor* process);
   void ref();
   static void unref(MPI_Group group);
   int size() { return size_; }
   void ref();
   static void unref(MPI_Group group);
   int size() { return size_; }
index 8e6f16c..eae4244 100644 (file)
@@ -213,7 +213,7 @@ void ActorExt::init()
   xbt_assert(smpi_get_universe_size() != 0, "SimGrid was not initialized properly before entering MPI_Init. "
                                             "Aborting, please check compilation process and use smpirun.");
 
   xbt_assert(smpi_get_universe_size() != 0, "SimGrid was not initialized properly before entering MPI_Init. "
                                             "Aborting, please check compilation process and use smpirun.");
 
-  simgrid::s4u::ActorPtr self = simgrid::s4u::Actor::self();
+  simgrid::s4u::Actor* self = simgrid::s4u::Actor::self();
   // cheinrich: I'm not sure what the impact of the SMPI_switch_data_segment on this call is. I moved
   // this up here so that I can set the privatized region before the switch.
   ActorExt* ext = smpi_process();
   // cheinrich: I'm not sure what the impact of the SMPI_switch_data_segment on this call is. I moved
   // this up here so that I can set the privatized region before the switch.
   ActorExt* ext = smpi_process();
index 6aa940a..5cf91eb 100644 (file)
@@ -65,7 +65,7 @@ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_
   smpi_instances.insert(std::pair<std::string, Instance>(name, instance));
 }
 
   smpi_instances.insert(std::pair<std::string, Instance>(name, instance));
 }
 
-void smpi_deployment_register_process(const std::string& instance_id, int rank, simgrid::s4u::ActorPtr actor)
+void smpi_deployment_register_process(const std::string& instance_id, int rank, simgrid::s4u::Actor* actor)
 {
   Instance& instance = smpi_instances.at(instance_id);
   instance.comm_world_->group()->set_mapping(actor, rank);
 {
   Instance& instance = smpi_instances.at(instance_id);
   instance.comm_world_->group()->set_mapping(actor, rank);
index 8571f38..ed24882 100644 (file)
@@ -275,7 +275,7 @@ MPI_Comm Comm::split(int color, int key)
           group_root = group_out; /* Save root's group */
         }
         for (unsigned j = 0; j < rankmap.size(); j++) {
           group_root = group_out; /* Save root's group */
         }
         for (unsigned j = 0; j < rankmap.size(); j++) {
-          s4u::ActorPtr actor = group->actor(rankmap[j].second);
+          s4u::Actor* actor = group->actor(rankmap[j].second);
           group_out->set_mapping(actor, j);
         }
         MPI_Request* requests = xbt_new(MPI_Request, rankmap.size());
           group_out->set_mapping(actor, j);
         }
         MPI_Request* requests = xbt_new(MPI_Request, rankmap.size());
@@ -345,7 +345,7 @@ MPI_Comm Comm::find_intra_comm(int * leader){
   int min_index           = INT_MAX; // the minimum index will be the leader
   for (auto& actor : process_list) {
     int index = actor.get_pid();
   int min_index           = INT_MAX; // the minimum index will be the leader
   for (auto& actor : process_list) {
     int index = actor.get_pid();
-    if (this->group()->rank(actor.iface()) != MPI_UNDEFINED) { // Is this process in the current group?
+    if (this->group()->rank(actor.ciface()) != MPI_UNDEFINED) { // Is this process in the current group?
       intra_comm_size++;
       if (index < min_index)
         min_index = index;
       intra_comm_size++;
       if (index < min_index)
         min_index = index;
@@ -355,8 +355,8 @@ MPI_Comm Comm::find_intra_comm(int * leader){
   MPI_Group group_intra = new  Group(intra_comm_size);
   int i = 0;
   for (auto& actor : process_list) {
   MPI_Group group_intra = new  Group(intra_comm_size);
   int i = 0;
   for (auto& actor : process_list) {
-    if (this->group()->rank(actor.iface()) != MPI_UNDEFINED) {
-      group_intra->set_mapping(actor.iface(), i);
+    if (this->group()->rank(actor.ciface()) != MPI_UNDEFINED) {
+      group_intra->set_mapping(actor.ciface(), i);
       i++;
     }
   }
       i++;
     }
   }
@@ -426,7 +426,7 @@ void Comm::init_smp(){
   if(MPI_COMM_WORLD!=MPI_COMM_UNINITIALIZED && this!=MPI_COMM_WORLD){
     //create leader_communicator
     for (i=0; i< leader_group_size;i++)
   if(MPI_COMM_WORLD!=MPI_COMM_UNINITIALIZED && this!=MPI_COMM_WORLD){
     //create leader_communicator
     for (i=0; i< leader_group_size;i++)
-      leaders_group->set_mapping(s4u::Actor::by_pid(leader_list[i]), i);
+      leaders_group->set_mapping(s4u::Actor::by_pid(leader_list[i]).get(), i);
     leader_comm = new  Comm(leaders_group, nullptr,1);
     this->set_leaders_comm(leader_comm);
     this->set_intra_comm(comm_intra);
     leader_comm = new  Comm(leaders_group, nullptr,1);
     this->set_leaders_comm(leader_comm);
     this->set_intra_comm(comm_intra);
@@ -434,7 +434,7 @@ void Comm::init_smp(){
     // create intracommunicator
   }else{
     for (i=0; i< leader_group_size;i++)
     // create intracommunicator
   }else{
     for (i=0; i< leader_group_size;i++)
-      leaders_group->set_mapping(s4u::Actor::by_pid(leader_list[i]), i);
+      leaders_group->set_mapping(s4u::Actor::by_pid(leader_list[i]).get(), i);
 
     if(this->get_leaders_comm()==MPI_COMM_NULL){
       leader_comm = new  Comm(leaders_group, nullptr,1);
 
     if(this->get_leaders_comm()==MPI_COMM_NULL){
       leader_comm = new  Comm(leaders_group, nullptr,1);
index eea8e73..cbd973a 100644 (file)
@@ -28,9 +28,8 @@ Group::Group(Group* origin)
   }
 }
 
   }
 }
 
-void Group::set_mapping(s4u::ActorPtr actor_ptr, int rank)
+void Group::set_mapping(s4u::Actor* actor, int rank)
 {
 {
-  s4u::Actor* actor = actor_ptr.get();
   if (0 <= rank && rank < size_) {
     int index                = actor->get_pid();
     if (index != MPI_UNDEFINED) {
   if (0 <= rank && rank < size_) {
     int index                = actor->get_pid();
     if (index != MPI_UNDEFINED) {
@@ -55,7 +54,7 @@ int Group::rank(int index)
   return rank;
 }
 
   return rank;
 }
 
-s4u::ActorPtr Group::actor(int rank)
+s4u::Actor* Group::actor(int rank)
 {
   if (0 <= rank && rank < size_)
     return rank_to_actor_map_[rank];
 {
   if (0 <= rank && rank < size_)
     return rank_to_actor_map_[rank];
@@ -63,9 +62,9 @@ s4u::ActorPtr Group::actor(int rank)
     return nullptr;
 }
 
     return nullptr;
 }
 
-int Group::rank(s4u::ActorPtr actor)
+int Group::rank(s4u::Actor* actor)
 {
 {
-  auto iterator = actor_to_rank_map_.find(actor.get());
+  auto iterator = actor_to_rank_map_.find(actor);
   return (iterator == actor_to_rank_map_.end()) ? MPI_UNDEFINED : (*iterator).second;
 }
 
   return (iterator == actor_to_rank_map_.end()) ? MPI_UNDEFINED : (*iterator).second;
 }
 
@@ -91,7 +90,7 @@ int Group::compare(MPI_Group group2)
     result = MPI_UNEQUAL;
   } else {
     for (int i = 0; i < size_; i++) {
     result = MPI_UNEQUAL;
   } else {
     for (int i = 0; i < size_; i++) {
-      s4u::ActorPtr actor = this->actor(i);
+      s4u::Actor* actor = this->actor(i);
       int rank = group2->rank(actor);
       if (rank == MPI_UNDEFINED) {
         result = MPI_UNEQUAL;
       int rank = group2->rank(actor);
       if (rank == MPI_UNDEFINED) {
         result = MPI_UNEQUAL;
@@ -117,7 +116,7 @@ int Group::incl(int n, const int* ranks, MPI_Group* newgroup)
   } else {
     *newgroup = new Group(n);
     for (i = 0; i < n; i++) {
   } else {
     *newgroup = new Group(n);
     for (i = 0; i < n; i++) {
-      s4u::ActorPtr actor = this->actor(ranks[i]); // ranks[] was passed as a param!
+      s4u::Actor* actor = this->actor(ranks[i]); // ranks[] was passed as a param!
       (*newgroup)->set_mapping(actor, i);
     }
   }
       (*newgroup)->set_mapping(actor, i);
     }
   }
@@ -129,7 +128,7 @@ int Group::group_union(MPI_Group group2, MPI_Group* newgroup)
   int size1 = size_;
   int size2 = group2->size();
   for (int i = 0; i < size2; i++) {
   int size1 = size_;
   int size2 = group2->size();
   for (int i = 0; i < size2; i++) {
-    s4u::ActorPtr actor = group2->actor(i);
+    s4u::Actor* actor = group2->actor(i);
     int proc1 = this->rank(actor);
     if (proc1 == MPI_UNDEFINED) {
       size1++;
     int proc1 = this->rank(actor);
     if (proc1 == MPI_UNDEFINED) {
       size1++;
@@ -141,11 +140,11 @@ int Group::group_union(MPI_Group group2, MPI_Group* newgroup)
     *newgroup = new  Group(size1);
     size2 = this->size();
     for (int i = 0; i < size2; i++) {
     *newgroup = new  Group(size1);
     size2 = this->size();
     for (int i = 0; i < size2; i++) {
-      s4u::ActorPtr actor1 = this->actor(i);
+      s4u::Actor* actor1 = this->actor(i);
       (*newgroup)->set_mapping(actor1, i);
     }
     for (int i = size2; i < size1; i++) {
       (*newgroup)->set_mapping(actor1, i);
     }
     for (int i = size2; i < size1; i++) {
-      s4u::ActorPtr actor = group2->actor(i - size2);
+      s4u::Actor* actor = group2->actor(i - size2);
       (*newgroup)->set_mapping(actor, i);
     }
   }
       (*newgroup)->set_mapping(actor, i);
     }
   }
@@ -156,7 +155,7 @@ int Group::intersection(MPI_Group group2, MPI_Group* newgroup)
 {
   int size2 = group2->size();
   for (int i = 0; i < size2; i++) {
 {
   int size2 = group2->size();
   for (int i = 0; i < size2; i++) {
-    s4u::ActorPtr actor = group2->actor(i);
+    s4u::Actor* actor = group2->actor(i);
     int proc1 = this->rank(actor);
     if (proc1 == MPI_UNDEFINED) {
       size2--;
     int proc1 = this->rank(actor);
     if (proc1 == MPI_UNDEFINED) {
       size2--;
@@ -168,7 +167,7 @@ int Group::intersection(MPI_Group group2, MPI_Group* newgroup)
     *newgroup = new  Group(size2);
     int j=0;
     for (int i = 0; i < group2->size(); i++) {
     *newgroup = new  Group(size2);
     int j=0;
     for (int i = 0; i < group2->size(); i++) {
-      s4u::ActorPtr actor = group2->actor(i);
+      s4u::Actor* actor = group2->actor(i);
       int proc1 = this->rank(actor);
       if (proc1 != MPI_UNDEFINED) {
         (*newgroup)->set_mapping(actor, j);
       int proc1 = this->rank(actor);
       if (proc1 != MPI_UNDEFINED) {
         (*newgroup)->set_mapping(actor, j);
@@ -184,7 +183,7 @@ int Group::difference(MPI_Group group2, MPI_Group* newgroup)
   int newsize = size_;
   int size2 = size_;
   for (int i = 0; i < size2; i++) {
   int newsize = size_;
   int size2 = size_;
   for (int i = 0; i < size2; i++) {
-    s4u::ActorPtr actor = this->actor(i);
+    s4u::Actor* actor = this->actor(i);
     int proc2 = group2->rank(actor);
     if (proc2 != MPI_UNDEFINED) {
       newsize--;
     int proc2 = group2->rank(actor);
     if (proc2 != MPI_UNDEFINED) {
       newsize--;
@@ -195,7 +194,7 @@ int Group::difference(MPI_Group group2, MPI_Group* newgroup)
   } else {
     *newgroup = new  Group(newsize);
     for (int i = 0; i < size2; i++) {
   } else {
     *newgroup = new  Group(newsize);
     for (int i = 0; i < size2; i++) {
-      s4u::ActorPtr actor = this->actor(i);
+      s4u::Actor* actor = this->actor(i);
       int proc2 = group2->rank(actor);
       if (proc2 == MPI_UNDEFINED) {
         (*newgroup)->set_mapping(actor, i);
       int proc2 = group2->rank(actor);
       if (proc2 == MPI_UNDEFINED) {
         (*newgroup)->set_mapping(actor, i);
@@ -217,7 +216,7 @@ int Group::excl(int n, const int *ranks, MPI_Group * newgroup){
   int j = 0;
   for (int i = 0; i < oldsize; i++) {
     if(to_exclude[i]==0){
   int j = 0;
   for (int i = 0; i < oldsize; i++) {
     if(to_exclude[i]==0){
-      s4u::ActorPtr actor = this->actor(i);
+      s4u::Actor* actor = this->actor(i);
       (*newgroup)->set_mapping(actor, j);
       j++;
     }
       (*newgroup)->set_mapping(actor, j);
       j++;
     }
@@ -256,7 +255,7 @@ int Group::range_incl(int n, int ranges[][3], MPI_Group * newgroup){
     for (int rank = ranges[i][0];                    /* First */
          rank >= 0 && rank < size_; /* Last */
          ) {
     for (int rank = ranges[i][0];                    /* First */
          rank >= 0 && rank < size_; /* Last */
          ) {
-      s4u::ActorPtr actor = this->actor(rank);
+      s4u::Actor* actor = this->actor(rank);
       (*newgroup)->set_mapping(actor, j);
       j++;
       if(rank == ranges[i][1]){/*already last ?*/
       (*newgroup)->set_mapping(actor, j);
       j++;
       if(rank == ranges[i][1]){/*already last ?*/
@@ -308,7 +307,7 @@ int Group::range_excl(int n, int ranges[][3], MPI_Group * newgroup){
         }
       }
       if(add==1){
         }
       }
       if(add==1){
-        s4u::ActorPtr actor = this->actor(oldrank);
+        s4u::Actor* actor = this->actor(oldrank);
         (*newgroup)->set_mapping(actor, newrank);
         newrank++;
       }
         (*newgroup)->set_mapping(actor, newrank);
         newrank++;
       }