Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify SMPI process creation a tiny bit
[simgrid.git] / src / smpi / smpi_global.cpp
index 0acc0d4..9ce3361 100644 (file)
@@ -177,9 +177,7 @@ int smpi_enabled() {
 
 void smpi_global_init()
 {
-  int i;
   MPI_Group group;
-  int smpirun=0;
 
   if (!MC_is_active()) {
     global_timer = xbt_os_timer_new();
@@ -276,24 +274,26 @@ void smpi_global_init()
     }
   }
 #endif
+
+  int smpirun = 0;
   if (process_count == 0){
     process_count = SIMIX_process_count();
     smpirun=1;
   }
   smpi_universe_size = process_count;
   process_data       = new simgrid::smpi::Process*[process_count];
-  for (i = 0; i < process_count; i++) {
-    process_data[i]                       = new simgrid::smpi::Process(i);
+  for (int i = 0; i < process_count; i++) {
+    process_data[i] = new simgrid::smpi::Process(i);
   }
   //if the process was launched through smpirun script we generate a global mpi_comm_world
   //if not, we let MPI_COMM_NULL, and the comm world will be private to each mpi instance
-  if(smpirun){
+  if (smpirun) {
     group = new  simgrid::smpi::Group(process_count);
     MPI_COMM_WORLD = new  simgrid::smpi::Comm(group, nullptr);
     MPI_Attr_put(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, reinterpret_cast<void *>(process_count));
     msg_bar_t bar = MSG_barrier_init(process_count);
 
-    for (i = 0; i < process_count; i++) {
+    for (int i = 0; i < process_count; i++) {
       group->set_mapping(i, i);
       process_data[i]->set_finalization_barrier(bar);
     }