Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #17 from mpoquet/master
[simgrid.git] / src / smpi / smpi_base.c
index 84edb27..a5d2d73 100644 (file)
@@ -135,12 +135,19 @@ static double smpi_os(double size)
   unsigned int iter = 0;
   s_smpi_factor_t fact;
   double current=0.0;
+  // Iterate over all the sections that were specified and find the right
+  // value. (fact.factor represents the interval sizes; we want to find the
+  // section that has fact.factor <= size and no other such fact.factor <= size)
+  // Note: parse_factor() (used before) already sorts the dynar we iterate over!
   xbt_dynar_foreach(smpi_os_values, iter, fact) {
-    if (size <= fact.factor) {
+    if (size <= fact.factor) { // Values already too large, use the previously
+                               // computed value of current!
         XBT_DEBUG("os : %f <= %ld return %f", size, fact.factor, current);
       return current;
     }else{
-      current=fact.values[0]+fact.values[1]*size;
+      // If the next section is too large, the current section must be used.
+      // Hence, save the cost, as we might have to use it.
+      current = fact.values[0]+fact.values[1]*size;
     }
   }
   XBT_DEBUG("os : %f > %ld return %f", size, fact.factor, current);
@@ -157,12 +164,19 @@ static double smpi_ois(double size)
   unsigned int iter = 0;
   s_smpi_factor_t fact;
   double current=0.0;
+  // Iterate over all the sections that were specified and find the right
+  // value. (fact.factor represents the interval sizes; we want to find the
+  // section that has fact.factor <= size and no other such fact.factor <= size)
+  // Note: parse_factor() (used before) already sorts the dynar we iterate over!
   xbt_dynar_foreach(smpi_ois_values, iter, fact) {
-    if (size <= fact.factor) {
+    if (size <= fact.factor) { // Values already too large, use the previously
+                               // computed value of current!
         XBT_DEBUG("ois : %f <= %ld return %f", size, fact.factor, current);
       return current;
     }else{
-      current=fact.values[0]+fact.values[1]*size;
+      // If the next section is too large, the current section must be used.
+      // Hence, save the cost, as we might have to use it.
+      current = fact.values[0]+fact.values[1]*size;
     }
   }
   XBT_DEBUG("ois : %f > %ld return %f", size, fact.factor, current);
@@ -179,12 +193,20 @@ static double smpi_or(double size)
   unsigned int iter = 0;
   s_smpi_factor_t fact;
   double current=0.0;
+  // Iterate over all the sections that were specified and find the right
+  // value. (fact.factor represents the interval sizes; we want to find the
+  // section that has fact.factor <= size and no other such fact.factor <= size)
+  // Note: parse_factor() (used before) already sorts the dynar we iterate over!
   xbt_dynar_foreach(smpi_or_values, iter, fact) {
-    if (size <= fact.factor) {
+    if (size <= fact.factor) { // Values already too large, use the previously
+                               // computed value of current!
         XBT_DEBUG("or : %f <= %ld return %f", size, fact.factor, current);
       return current;
-    }else
+    } else {
+      // If the next section is too large, the current section must be used.
+      // Hence, save the cost, as we might have to use it.
       current=fact.values[0]+fact.values[1]*size;
+    }
   }
   XBT_DEBUG("or : %f > %ld return %f", size, fact.factor, current);
 
@@ -274,35 +296,6 @@ void smpi_empty_status(MPI_Status * status)
   }
 }
 
-void smpi_action_trace_run(char *path)
-{
-  char *name;
-  xbt_dynar_t todo;
-  xbt_dict_cursor_t cursor;
-
-  action_fp=NULL;
-  if (path) {
-    action_fp = fopen(path, "r");
-    if (action_fp == NULL)
-      xbt_die("Cannot open %s: %s", path, strerror(errno));
-  }
-
-  if (!xbt_dict_is_empty(action_queues)) {
-    XBT_WARN
-      ("Not all actions got consumed. If the simulation ended successfully (without deadlock), you may want to add new processes to your deployment file.");
-
-
-    xbt_dict_foreach(action_queues, cursor, name, todo) {
-      XBT_WARN("Still %lu actions for %s", xbt_dynar_length(todo), name);
-    }
-  }
-
-  if (path)
-    fclose(action_fp);
-  xbt_dict_free(&action_queues);
-  action_queues = xbt_dict_new_homogeneous(NULL);
-}
-
 static void smpi_mpi_request_free_voidp(void* request)
 {
   MPI_Request req = request;