Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add some more calls to smpi temp buffers allocation functions
[simgrid.git] / src / smpi / smpi_comm.c
index f4d32cb..c6da369 100644 (file)
@@ -128,35 +128,51 @@ void smpi_comm_get_name (MPI_Comm comm, char* name, int* len)
 }
 
 void smpi_comm_set_leaders_comm(MPI_Comm comm, MPI_Comm leaders){
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
   comm->leaders_comm=leaders;
 }
 
 void smpi_comm_set_intra_comm(MPI_Comm comm, MPI_Comm leaders){
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
   comm->intra_comm=leaders;
 }
 
 int* smpi_comm_get_non_uniform_map(MPI_Comm comm){
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
   return comm->non_uniform_map;
 }
 
 int* smpi_comm_get_leaders_map(MPI_Comm comm){
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
   return comm->leaders_map;
 }
 
 MPI_Comm smpi_comm_get_leaders_comm(MPI_Comm comm){
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
   return comm->leaders_comm;
 }
 
 MPI_Comm smpi_comm_get_intra_comm(MPI_Comm comm){
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
   if(comm==MPI_COMM_WORLD) return smpi_process_get_comm_intra();
   else return comm->intra_comm;
 }
 
 int smpi_comm_is_uniform(MPI_Comm comm){
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
   return comm->is_uniform;
 }
 
 int smpi_comm_is_blocked(MPI_Comm comm){
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
   return comm->is_blocked;
 }
 
@@ -277,6 +293,10 @@ compare_ints (const void *a, const void *b)
 
 void smpi_comm_init_smp(MPI_Comm comm){
   int leader = -1;
+
+  if (comm == MPI_COMM_UNINITIALIZED)
+    comm = smpi_process_comm_world();
+
   int comm_size =smpi_comm_size(comm);
   
   // If we are in replay - perform an ugly hack  
@@ -350,7 +370,7 @@ void smpi_comm_init_smp(MPI_Comm comm){
   smpi_coll_tuned_allgather_mpich(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, comm);
 
   if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
-     switch_data_segment(smpi_process_index());
+     smpi_switch_data_segment(smpi_process_index());
    }
    
   if(!comm->leaders_map){
@@ -422,7 +442,7 @@ void smpi_comm_init_smp(MPI_Comm comm){
   smpi_coll_tuned_bcast_mpich(&(comm->is_uniform),1, MPI_INT, 0, comm_intra );
 
   if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
-     switch_data_segment(smpi_process_index());
+     smpi_switch_data_segment(smpi_process_index());
    }
   // Are the ranks blocked ? = allocated contiguously on the SMP nodes
   int is_blocked=1;