Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
start snake_casing s4u::Actor
[simgrid.git] / src / smpi / internals / smpi_process.cpp
index 967936f..eda3a68 100644 (file)
@@ -24,8 +24,8 @@ using simgrid::s4u::ActorPtr;
 Process::Process(ActorPtr actor, msg_bar_t finalization_barrier)
     : finalization_barrier_(finalization_barrier), process_(actor)
 {
-  mailbox_         = simgrid::s4u::Mailbox::byName("SMPI-" + std::to_string(process_->getPid()));
-  mailbox_small_   = simgrid::s4u::Mailbox::byName("small-" + std::to_string(process_->getPid()));
+  mailbox_         = simgrid::s4u::Mailbox::byName("SMPI-" + std::to_string(process_->get_pid()));
+  mailbox_small_   = simgrid::s4u::Mailbox::byName("small-" + std::to_string(process_->get_pid()));
   mailboxes_mutex_ = xbt_mutex_init();
   timer_           = xbt_os_timer_new();
   state_           = SMPI_UNINITIALIZED;
@@ -63,8 +63,8 @@ Process::~Process()
 void Process::set_data(int* argc, char*** argv)
 {
   instance_id_      = std::string((*argv)[1]);
-  comm_world_       = smpi_deployment_comm_world(instance_id_.c_str());
-  msg_bar_t barrier = smpi_deployment_finalization_barrier(instance_id_.c_str());
+  comm_world_       = smpi_deployment_comm_world(instance_id_);
+  msg_bar_t barrier = smpi_deployment_finalization_barrier(instance_id_);
   if (barrier != nullptr) // don't overwrite the current one if the instance has none
     finalization_barrier_ = barrier;
 
@@ -81,14 +81,14 @@ void Process::set_data(int* argc, char*** argv)
   argv_ = argv;
   // set the process attached to the mailbox
   mailbox_small_->setReceiver(process_);
-  XBT_DEBUG("<%lu> SMPI process has been initialized: %p", process_->getPid(), process_.get());
+  XBT_DEBUG("<%ld> SMPI process has been initialized: %p", process_->get_pid(), process_.get());
 }
 
 /** @brief Prepares the current process for termination. */
 void Process::finalize()
 {
   state_ = SMPI_FINALIZED;
-  XBT_DEBUG("<%lu> Process left the game", process_->getPid());
+  XBT_DEBUG("<%ld> Process left the game", process_->get_pid());
 
   // This leads to an explosion of the search graph which cannot be reduced:
   if(MC_is_active() || MC_record_replay_is_active())
@@ -262,19 +262,25 @@ void Process::init(int *argc, char ***argv){
     // 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.
     Process* process = smpi_process_remote(proc);
-    int my_proc_id   = proc->getPid();
-    if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
+    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());
       /* Done at the process's creation */
-      SMPI_switch_data_segment(my_proc_id);
+      SMPI_switch_data_segment(proc);
     }
 
     process->set_data(argc, argv);
   }
-  xbt_assert(smpi_process(),
-      "smpi_process() returned nullptr. You probably gave a nullptr parameter to MPI_Init. "
-      "Although it's required by MPI-2, this is currently not supported by SMPI.");
+  xbt_assert(smpi_process(), "smpi_process() returned nullptr. You probably gave a nullptr parameter to MPI_Init. "
+                             "Although it's required by MPI-2, this is currently not supported by SMPI. "
+                             "Please use MPI_Init(&argc, &argv) as usual instead.");
+}
+
+int Process::get_optind(){
+  return optind;
+}
+void Process::set_optind(int new_optind){
+  optind=new_optind;
 }
 
 }