Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
smpi: some useless cleanups while I read this code
[simgrid.git] / src / smpi / internals / smpi_actor.cpp
index e0aef7d..3a5af91 100644 (file)
@@ -19,10 +19,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_process, smpi, "Logging specific to SMPI (k
 namespace simgrid {
 namespace smpi {
 
-using simgrid::s4u::Actor;
-using simgrid::s4u::ActorPtr;
-
-ActorExt::ActorExt(ActorPtr actor, simgrid::s4u::Barrier* finalization_barrier)
+ActorExt::ActorExt(s4u::ActorPtr actor, s4u::Barrier* finalization_barrier)
     : finalization_barrier_(finalization_barrier), actor_(actor)
 {
   mailbox_         = s4u::Mailbox::by_name("SMPI-" + std::to_string(actor_->get_pid()));
@@ -30,6 +27,7 @@ ActorExt::ActorExt(ActorPtr actor, simgrid::s4u::Barrier* finalization_barrier)
   mailboxes_mutex_ = s4u::Mutex::create();
   timer_           = xbt_os_timer_new();
   state_           = SmpiProcessState::UNINITIALIZED;
+  info_env_        = MPI_INFO_NULL;
   if (MC_is_active())
     MC_ignore_heap(timer_, xbt_os_timer_size());
 
@@ -124,7 +122,7 @@ bool ActorExt::replaying()
   return replaying_;
 }
 
-ActorPtr ActorExt::get_actor()
+s4u::ActorPtr ActorExt::get_actor()
 {
   return actor_;
 }
@@ -196,6 +194,11 @@ MPI_Comm ActorExt::comm_self()
   return comm_self_;
 }
 
+MPI_Info ActorExt::info_env()
+{
+  return info_env_;
+}
+
 MPI_Comm ActorExt::comm_intra()
 {
   return comm_intra_;
@@ -218,10 +221,8 @@ int ActorExt::sampling()
 
 void ActorExt::init()
 {
-  if (smpi_process_count() == 0) {
-    xbt_die("SimGrid was not initialized properly before entering MPI_Init. Aborting, please check compilation process "
-            "and use smpirun\n");
-  }
+  xbt_assert(smpi_process_count() != 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();
   // cheinrich: I'm not sure what the impact of the SMPI_switch_data_segment on this call is. I moved
@@ -238,8 +239,8 @@ void ActorExt::init()
     SMPI_switch_data_segment(proc);
   }
 
-  const char* instance_id = simgrid::s4u::Actor::self()->get_property("instance_id");
-  const int rank          = xbt_str_parse_int(simgrid::s4u::Actor::self()->get_property("rank"), "Cannot parse rank");
+  const char* instance_id = proc->get_property("instance_id");
+  const int rank          = xbt_str_parse_int(proc->get_property("rank"), "Cannot parse rank");
 
   process->state_ = SmpiProcessState::INITIALIZING;
   smpi_deployment_register_process(instance_id, rank, proc);
@@ -249,11 +250,12 @@ void ActorExt::init()
 
 int ActorExt::get_optind()
 {
-  return optind;
+  return optind_;
 }
+
 void ActorExt::set_optind(int new_optind)
 {
-  optind = new_optind;
+  optind_ = new_optind;
 }
 
 } // namespace smpi