Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI init: stringify and rename a variable
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 31 Jul 2019 09:25:17 +0000 (11:25 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 31 Jul 2019 09:25:17 +0000 (11:25 +0200)
src/smpi/include/smpi_actor.hpp
src/smpi/internals/smpi_actor.cpp

index 58e7e48..a0ee3b2 100644 (file)
@@ -49,7 +49,7 @@ public:
   ActorExt(const ActorExt&) = delete;
   ActorExt& operator=(const ActorExt&) = delete;
   ~ActorExt();
   ActorExt(const ActorExt&) = delete;
   ActorExt& operator=(const ActorExt&) = delete;
   ~ActorExt();
-  void set_data(const char* instance_id);
+  void set_data(const std::string& instance_id);
   void finalize();
   int finalized();
   int initializing();
   void finalize();
   int finalized();
   int initializing();
index c4c7e81..3b91956 100644 (file)
@@ -58,9 +58,9 @@ ActorExt::~ActorExt()
   xbt_os_timer_free(timer_);
 }
 
   xbt_os_timer_free(timer_);
 }
 
-void ActorExt::set_data(const char* instance_id)
+void ActorExt::set_data(const std::string& instance_id)
 {
 {
-  instance_id_                   = std::string(instance_id);
+  instance_id_                   = instance_id;
   comm_world_                    = smpi_deployment_comm_world(instance_id_);
   simgrid::s4u::Barrier* barrier = smpi_deployment_finalization_barrier(instance_id_);
   if (barrier != nullptr) // don't overwrite the current one if the instance has none
   comm_world_                    = smpi_deployment_comm_world(instance_id_);
   simgrid::s4u::Barrier* barrier = smpi_deployment_finalization_barrier(instance_id_);
   if (barrier != nullptr) // don't overwrite the current one if the instance has none
@@ -224,28 +224,28 @@ 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 proc = simgrid::s4u::Actor::self();
+  simgrid::s4u::ActorPtr 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.
   // 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* process = smpi_process_remote(proc);
+  ActorExt* ext = smpi_process_remote(self);
   // if we are in MPI_Init and argc handling has already been done.
   // if we are in MPI_Init and argc handling has already been done.
-  if (process->initialized())
+  if (ext->initialized())
     return;
 
   if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
     /* Now using the segment index of this process  */
     return;
 
   if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
     /* Now using the segment index of this process  */
-    process->set_privatized_region(smpi_init_global_memory_segment_process());
+    ext->set_privatized_region(smpi_init_global_memory_segment_process());
     /* Done at the process's creation */
     /* Done at the process's creation */
-    SMPI_switch_data_segment(proc);
+    SMPI_switch_data_segment(self);
   }
 
   }
 
-  const char* instance_id = proc->get_property("instance_id");
-  const int rank          = xbt_str_parse_int(proc->get_property("rank"), "Cannot parse rank");
+  std::string instance_id = self->get_property("instance_id");
+  const int rank          = xbt_str_parse_int(self->get_property("rank"), "Cannot parse rank");
 
 
-  process->state_ = SmpiProcessState::INITIALIZING;
-  smpi_deployment_register_process(instance_id, rank, proc);
+  ext->state_ = SmpiProcessState::INITIALIZING;
+  smpi_deployment_register_process(instance_id, rank, self);
 
 
-  process->set_data(instance_id);
+  ext->set_data(instance_id);
 }
 
 int ActorExt::get_optind()
 }
 
 int ActorExt::get_optind()