Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bring C++ for MPI_Group.
[simgrid.git] / src / smpi / smpi_global.cpp
index bcc611c..2ecc4f3 100644 (file)
@@ -15,6 +15,7 @@
 #include "src/mc/mc_replay.h"
 #include "src/msg/msg_private.h"
 #include "src/simix/smx_private.h"
+#include "src/smpi/smpi_group.hpp"
 #include "surf/surf.h"
 #include "xbt/replay.h"
 
@@ -352,9 +353,9 @@ MPI_Comm smpi_process_comm_self()
 {
   smpi_process_data_t data = smpi_process_data();
   if(data->comm_self==MPI_COMM_NULL){
-    MPI_Group group = smpi_group_new(1);
+    MPI_Group group = new simgrid::SMPI::Group(1);
     data->comm_self = smpi_comm_new(group, nullptr);
-    smpi_group_set_mapping(group, smpi_process_index(), 0);
+    group->set_mapping(smpi_process_index(), 0);
   }
 
   return data->comm_self;
@@ -604,13 +605,13 @@ void smpi_global_init()
   //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){
-    group = smpi_group_new(process_count);
+    group = new simgrid::SMPI::Group(process_count);
     MPI_COMM_WORLD = smpi_comm_new(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++) {
-      smpi_group_set_mapping(group, i, i);
+      group->set_mapping(i, i);
       process_data[i]->finalization_barrier = bar;
     }
   }
@@ -622,7 +623,7 @@ void smpi_global_destroy()
 
   smpi_bench_destroy();
   if (MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED){
-      while (smpi_group_unuse(smpi_comm_group(MPI_COMM_WORLD)) > 0);
+      while (smpi_comm_group(MPI_COMM_WORLD)->unuse() > 0);
       MSG_barrier_destroy(process_data[0]->finalization_barrier);
   }else{
       smpi_deployment_cleanup_instances();