Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Remove usage of index() in smpi_pmpi_coll.cpp
[simgrid.git] / src / smpi / internals / smpi_process.cpp
index 280e5e9..dc764fa 100644 (file)
@@ -6,6 +6,7 @@
 #include "smpi_process.hpp"
 #include "mc/mc.h"
 #include "private.hpp"
+#include "simgrid/s4u/forward.hpp"
 #include "smpi_comm.hpp"
 #include "smpi_group.hpp"
 #include "src/mc/mc_replay.hpp"
@@ -231,7 +232,7 @@ MPI_Comm Process::comm_self()
   if(comm_self_==MPI_COMM_NULL){
     MPI_Group group = new  Group(1);
     comm_self_ = new  Comm(group, nullptr);
-    group->set_mapping(index_, 0);
+    group->set_mapping(process_, 0);
   }
   return comm_self_;
 }
@@ -277,28 +278,28 @@ void Process::init(int *argc, char ***argv){
     simgrid::s4u::ActorPtr proc = simgrid::s4u::Actor::self();
     proc->getImpl()->context->set_cleanup(&MSG_process_cleanup_from_SIMIX);
 
-    int index = proc->getPid() - 1; // The maestro process has always ID 0 but we don't need that process here
+    int my_proc_id = proc->getPid() - 1; // The maestro process has always ID 0 but we don't need that process here
 
     char* instance_id = (*argv)[1];
     try {
       int rank = std::stoi(std::string((*argv)[2]));
-      smpi_deployment_register_process(instance_id, rank, index);
+      smpi_deployment_register_process(instance_id, rank, proc);
     } catch (std::invalid_argument& ia) {
       throw std::invalid_argument(std::string("Invalid rank: ") + (*argv)[2]);
     }
 
     // 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(index);
+    Process* process = smpi_process_remote(proc);
     if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
       /* Now using the segment index of this process  */
-      index = proc->getImpl()->segment_index;
+      my_proc_id = proc->getImpl()->segment_index;
       process->set_privatized_region(smpi_init_global_memory_segment_process());
       /* Done at the process's creation */
-      SMPI_switch_data_segment(index);
+      SMPI_switch_data_segment(my_proc_id);
     }
 
-    process->set_data(index, argc, argv);
+    process->set_data(my_proc_id, argc, argv);
   }
   xbt_assert(smpi_process(),
       "smpi_process() returned nullptr. You probably gave a nullptr parameter to MPI_Init. "