Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
dsend used for small messages
[simgrid.git] / src / surf / network.c
index 7a13932..8c0b232 100644 (file)
@@ -103,40 +103,61 @@ static double constant_bandwidth_constraint(double rate, double bound,
   return rate;
 }
 
-/**********************/
-/*   SMPI callbacks   */
-/**********************/
-static double smpi_latency_factor(double size)
+/**
+ *------------------ <copy/paste C code snippet in surf/network.c> ----------------------
+ *
+ * produced by: ./calibrate_piecewise.py griffon_skampi_pt2pt.ski.dat 2 2.4e-5 1.25e8 1536 65536
+ *
+ *---------------------------------------------------------------------------------------
+ **/
+static double smpi_bandwidth_factor(double size)
 {
-  /* 1 B <= size <= 1 KiB */
-  if (size <= 1024.0) {
-    return 1.0056;
-  }
-
-  /* 2 KiB <= size <= 32 KiB */
-  if (size <= 32768.0) {
-    return 1.8805;
-  }
-
-  /* 64 KiB <= size <= 4 MiB */
-  return 22.7111;
+        /* case 0.0 KiB <= size <= 1.5 KiB */
+        if (1 <=  size && size <= 1536) 
+               return(0.193137361131);
+        /* case 2.0 KiB <= size <= 64.0 KiB */
+        if (2048 <=  size && size <= 65536) 
+               return(0.584680317461);
+        /* case 65.0 KiB <= size */
+        if (66560 <=  size) 
+               return(0.933246215769);
+
+        /* ..:: inter-segment corrections ::.. */
+
+        /* case 1.5 KiB < size < 2.0 KiB */
+        if (1536 <  size && size < 2048) 
+               return(0.765607476636);
+        /* case 64.0 KiB < size < 65.0 KiB */
+        if (65536 <  size && size < 66560) 
+               return(1.24121212121);
 }
 
-static double smpi_bandwidth_factor(double size)
+static double smpi_latency_factor(double size)
 {
-  /* 1 B <= size <= 1 KiB */
-  if (size <= 1024.0) {
-    return 0.2758;
-  }
+        /* case 0.0 KiB <= size <= 1.5 KiB */
+        if (1 <=  size && size <= 1536) 
+               return(1.15019564848);
+        /* case 2.0 KiB <= size <= 64.0 KiB */
+        if (2048 <=  size && size <= 65536) 
+               return(1.80598448863);
+        /* case 65.0 KiB <= size <= 8192.0 KiB */
+        if (66560 <=  size) 
+               return(14.6187359323);
+
+        /* ..:: inter-segment corrections ::.. */
+
+        /* case 1.5 KiB < size < 2.0 KiB */
+        if (1536 <  size && size < 2048) 
+               return(2.1375);
+        /* case 64.0 KiB < size < 65.0 KiB */
+        if (65536 <  size && size < 66560) 
+               return(14.6375);
+}
 
-  /* 2 KiB <= size <= 32 KiB */
-  if (size <= 32768.0) {
-    return 0.5477;
-  }
+/**
+ *------------------ </copy/paste C code snippet in surf/network.c> ---------------------
+ **/
 
-  /* 64 KiB <= size <= 4 MiB */
-  return 0.9359;
-}
 
 static double smpi_bandwidth_constraint(double rate, double bound,
                                         double size)
@@ -437,17 +458,19 @@ static void net_update_actions_state(double now, double delta)
                                    action->weight);
     }
 #ifdef HAVE_TRACING
-    xbt_dynar_t route =
-        global_routing->get_route(action->src_name, action->dst_name);
-    link_CM02_t link;
-    unsigned int i;
-    xbt_dynar_foreach(route, i, link) {
-      TRACE_surf_link_set_utilization(link->lmm_resource.generic_resource.name,
-                                      action->generic_action.data,
-                                      (surf_action_t) action,
-                                      lmm_variable_getvalue
-                                      (action->variable), now - delta,
-                                      delta);
+    if (TRACE_is_enabled()) {
+      xbt_dynar_t route = global_routing->get_route(action->src_name,
+                                                    action->dst_name);
+      link_CM02_t link;
+      unsigned int i;
+      xbt_dynar_foreach(route, i, link) {
+        TRACE_surf_link_set_utilization(link->lmm_resource.generic_resource.name,
+                                        action->generic_action.data,
+                                        (surf_action_t) action,
+                                        lmm_variable_getvalue
+                                        (action->variable), now - delta,
+                                        delta);
+      }
     }
 #endif
     if(!lmm_get_number_of_cnst_from_var(network_maxmin_system, action->variable)) {
@@ -608,9 +631,9 @@ static surf_action_t net_communicate(const char *src_name,
 
   xbt_dynar_t back_route = NULL;
   int constraints_per_variable = 0;
-  // I will need this route for some time so let's call get_route_no_cleanup
-  xbt_dynar_t route = global_routing->get_route_no_cleanup(src_name, dst_name);
-
+  xbt_dynar_t route;
+  // I will need this route for some time so require for no cleanup
+  global_routing->get_route_latency(src_name, dst_name, &route, &latency, 0);
 
   if (sg_network_fullduplex == 1) {
     back_route = global_routing->get_route(dst_name, src_name);
@@ -622,7 +645,6 @@ static surf_action_t net_communicate(const char *src_name,
   XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
   /* LARGE PLATFORMS HACK:
      assert on total_route_size */
-  latency = global_routing->get_latency(src_name,dst_name);
   xbt_assert(xbt_dynar_length(route) || latency,
               "You're trying to send data from %s to %s but there is no connection at all between these two hosts.",
               src_name, dst_name);
@@ -731,9 +753,12 @@ static surf_action_t net_communicate(const char *src_name,
   /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 #ifdef HAVE_TRACING
-  action->src_name = xbt_strdup(src_name);
-
-  action->dst_name = xbt_strdup(dst_name);
+  if (TRACE_is_enabled()) {
+    action->src_name = xbt_strdup(src_name);
+    action->dst_name = xbt_strdup(dst_name);
+  } else {
+    action->src_name = action->dst_name = NULL;
+  }
 #endif
 
   xbt_dynar_free(&route);