Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add an smpi/ois factor, to account for the fact that MPI_Send and MPI_Isend internal...
authorAugustin Degomme <degomme@idpann.imag.fr>
Mon, 11 Feb 2013 17:27:33 +0000 (18:27 +0100)
committerAugustin Degomme <degomme@idpann.imag.fr>
Mon, 11 Feb 2013 17:27:33 +0000 (18:27 +0100)
src/simgrid/sg_config.c
src/smpi/smpi_base.c

index 5a6faa9..1bd37ae 100644 (file)
@@ -687,11 +687,17 @@ void sg_config_init(int *argc, char **argv)
     xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/lat_factor", "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;1426:1.61075;732:1.9503;257:1.95341;0:2.01467");
 
     xbt_cfg_register(&_sg_cfg_set, "smpi/os",
-                     "Small messages timings (MPI_Isend/Send minimum time for small messages)",
+                     "Small messages timings (MPI_Send minimum time for small messages)",
                      xbt_cfgelm_string, NULL, 1, 1, NULL,
                      NULL);
     xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/os", "1:0:0:0:0");
 
+    xbt_cfg_register(&_sg_cfg_set, "smpi/ois",
+                     "Small messages timings (MPI_Isend minimum time for small messages)",
+                     xbt_cfgelm_string, NULL, 1, 1, NULL,
+                     NULL);
+    xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/ois", "1:0:0:0:0");
+
     xbt_cfg_register(&_sg_cfg_set, "smpi/or",
                      "Small messages timings (MPI_Recv minimum time for small messages)",
                      xbt_cfgelm_string, NULL, 1, 1, NULL,
index 9cb7054..9e48e3c 100644 (file)
@@ -68,7 +68,7 @@ typedef struct s_smpi_factor {
 } s_smpi_factor_t;
 xbt_dynar_t smpi_os_values = NULL;
 xbt_dynar_t smpi_or_values = NULL;
-
+xbt_dynar_t smpi_ois_values = NULL;
 
 // Methods used to parse and store the values for timing injections in smpi
 // These are taken from surf/network.c and generalized to have more factors
@@ -139,6 +139,28 @@ static double smpi_os(double size)
   return current;
 }
 
+static double smpi_ois(double size)
+{
+  if (!smpi_ois_values)
+    smpi_ois_values =
+        parse_factor(sg_cfg_get_string("smpi/ois"));
+
+  unsigned int iter = 0;
+  s_smpi_factor_t fact;
+  double current=0.0;
+  xbt_dynar_foreach(smpi_ois_values, iter, fact) {
+    if (size <= fact.factor) {
+        XBT_DEBUG("ois : %lf <= %ld return %f", size, fact.factor, current);
+      return current;
+    }else{
+      current=fact.values[0]+fact.values[1]*size;
+    }
+  }
+  XBT_DEBUG("ois : %lf > %ld return %f", size, fact.factor, current);
+
+  return current;
+}
+
 static double smpi_or(double size)
 {
   if (!smpi_or_values)
@@ -339,7 +361,14 @@ void smpi_mpi_start(MPI_Request request)
     // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
     request->real_size=request->size;
     smpi_datatype_use(request->old_type);
-    double sleeptime = smpi_os(request->size);
+
+    //if we are giving back the control to the user without waiting for completion, we have to inject timings
+    double sleeptime =0.0;
+    if(request->detached && !(request->flags & ISEND))
+      sleeptime = smpi_os(request->size);
+    else
+      sleeptime = smpi_ois(request->size);
+
     if(sleeptime!=0.0){
         simcall_process_sleep(sleeptime);
         XBT_DEBUG("sending size of %zu : sleep %lf ", request->size, smpi_os(request->size));