Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Simplify, cleanup, remove useless bits, and some files.
[simgrid.git] / src / smpi / smpi_comm.cpp
index 973b24d..bbf41ec 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "private.h"
 #include "src/simix/smx_private.h"
-#include "colls/colls.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm)");
 
@@ -219,7 +218,7 @@ MPI_Comm Comm::split(int color, int key)
   } else {
     recvbuf = nullptr;
   }
-  smpi_mpi_gather(sendbuf, 2, MPI_INT, recvbuf, 2, MPI_INT, 0, this);
+  Coll_gather_default::gather(sendbuf, 2, MPI_INT, recvbuf, 2, MPI_INT, 0, this);
   xbt_free(sendbuf);
   /* Do the actual job */
   if(rank == 0) {
@@ -358,28 +357,26 @@ void Comm::init_smp(){
    }
   //identify neighbours in comm
   //get the indexes of all processes sharing the same simix host
-  xbt_swag_t process_list = SIMIX_host_self()->processes();
-  int intra_comm_size = 0;
-  int i =0;
-  int min_index=INT_MAX;//the minimum index will be the leader
-  smx_actor_t process = nullptr;
-  xbt_swag_foreach(process, process_list) {
-    int index = process->pid -1;
+  xbt_swag_t process_list = SIMIX_host_self()->extension<simgrid::simix::Host>()->process_list;
+  int intra_comm_size     = 0;
+  int min_index           = INT_MAX;//the minimum index will be the leader
+  smx_actor_t actor       = nullptr;
+  xbt_swag_foreach(actor, process_list) {
+    int index = actor->pid -1;
 
     if(this->group()->rank(index)!=MPI_UNDEFINED){
-        intra_comm_size++;
+      intra_comm_size++;
       //the process is in the comm
       if(index < min_index)
         min_index=index;
-      i++;
     }
   }
   XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size);
   MPI_Group group_intra = new  Group(intra_comm_size);
-  i=0;
-  process = nullptr;
-  xbt_swag_foreach(process, process_list) {
-    int index = process->pid -1;
+  int i = 0;
+  actor = nullptr;
+  xbt_swag_foreach(actor, process_list) {
+    int index = actor->pid -1;
     if(this->group()->rank(index)!=MPI_UNDEFINED){
       group_intra->set_mapping(index, i);
       i++;
@@ -395,7 +392,7 @@ void Comm::init_smp(){
       leader_list[i]=-1;
   }
 
-  smpi_coll_tuned_allgather_mpich(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, this);
+  Coll_allgather_mpich::allgather(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, this);
 
   if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process_index());
@@ -454,7 +451,7 @@ void Comm::init_smp(){
   int my_local_size=comm_intra->size();
   if(comm_intra->rank()==0) {
     int* non_uniform_map = xbt_new0(int,leader_group_size);
-    smpi_coll_tuned_allgather_mpich(&my_local_size, 1, MPI_INT,
+    Coll_allgather_mpich::allgather(&my_local_size, 1, MPI_INT,
         non_uniform_map, 1, MPI_INT, leader_comm);
     for(i=0; i < leader_group_size; i++) {
       if(non_uniform_map[0] != non_uniform_map[i]) {
@@ -469,7 +466,7 @@ void Comm::init_smp(){
     }
     is_uniform_=is_uniform;
   }
-  smpi_coll_tuned_bcast_mpich(&(is_uniform_),1, MPI_INT, 0, comm_intra );
+  Coll_bcast_mpich::bcast(&(is_uniform_),1, MPI_INT, 0, comm_intra );
 
   if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
      smpi_switch_data_segment(smpi_process_index());
@@ -487,7 +484,7 @@ void Comm::init_smp(){
   }
 
   int global_blocked;
-  smpi_mpi_allreduce(&is_blocked, &(global_blocked), 1, MPI_INT, MPI_LAND, this);
+  Coll_allreduce_default::allreduce(&is_blocked, &(global_blocked), 1, MPI_INT, MPI_LAND, this);
 
   if(MPI_COMM_WORLD==MPI_COMM_UNINITIALIZED || this==MPI_COMM_WORLD){
     if(this->rank()==0){