Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add an option smpi/iprobe, to inject sleeping time into a MPI_Iprobe call.
authorAugustin Degomme <degomme@idpann.imag.fr>
Thu, 2 May 2013 09:22:41 +0000 (11:22 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Tue, 7 May 2013 15:12:21 +0000 (17:12 +0200)
Change the way this sleep is done, to increase it each time a MPI_Iprobe fails, to accelerate simulation

src/simgrid/sg_config.c
src/smpi/smpi_base.c

index 63f1a02..34baf68 100644 (file)
@@ -759,7 +759,11 @@ void sg_config_init(int *argc, char **argv)
                      xbt_cfgelm_string, NULL, 1, 1, NULL,
                      NULL);
     xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/or", "1:0:0:0:0");
-
+    double default_iprobe_time = 1e-4;
+    xbt_cfg_register(&_sg_cfg_set, "smpi/iprobe",
+                     "Minimum time to inject inside a call to MPI_Iprobe",
+                     xbt_cfgelm_double, &default_iprobe_time, 1, 1, NULL,
+                     NULL);
     default_value = xbt_strdup("default");
     xbt_cfg_register(&_sg_cfg_set, "smpi/allgather",
                     "Which collective to use for allgather",
index e0cfc66..330bcc9 100644 (file)
@@ -682,9 +682,6 @@ void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status){
   while(flag==0){
     smpi_mpi_iprobe(source, tag, comm, &flag, status);
     XBT_DEBUG("Busy Waiting on probing : %d", flag);
-    if(!flag) {
-      simcall_process_sleep(0.0001);
-    }
   }
 }
 
@@ -692,6 +689,13 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
   MPI_Request request =build_request(NULL, 0, MPI_CHAR, source, smpi_comm_rank(comm), tag,
             comm, NON_PERSISTENT | RECV);
 
+  //to avoid deadlock, we have to sleep some time here, or the timer won't advance and we will only do iprobe simcalls
+  double sleeptime= sg_cfg_get_double("smpi/iprobe");
+  //multiplier to the sleeptime, to increase speed of execution, each failed iprobe will increase it
+  static int nsleeps = 1;
+
+  simcall_process_sleep(sleeptime);
+
   // behave like a receive, but don't do it
   smx_rdv_t mailbox;
 
@@ -717,8 +721,12 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
       status->MPI_ERROR = MPI_SUCCESS;
       status->count = req->real_size;
     }
+    nsleeps=1;//reset the number of sleeps we will do next time
+  }
+  else {
+      *flag = 0;
+      nsleeps++;
   }
-  else *flag = 0;
   smpi_mpi_request_free(&request);
 
   return;