Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add the bandwidth factor for the standard model as well as for the new LegrandVelho...
[simgrid.git] / src / surf / network.c
index 3114caa..7f207d0 100644 (file)
@@ -18,8 +18,10 @@ static void (*network_solve) (lmm_system_t) = NULL;
 xbt_dict_t link_set = NULL;
 xbt_dict_t network_card_set = NULL;
 
-double alpha_legrandvelho = 1;
-double beta_legrandvelho = 0;
+double latency_factor = 1.0; /* default value */
+double bandwidth_factor = 1.0; /* default value */
+
+
 int card_number = 0;
 int host_number = 0;
 link_CM02_t **routing_table = NULL;
@@ -72,7 +74,7 @@ static link_CM02_t link_new(char *name,
 
   nw_link->constraint =
       lmm_constraint_new(network_maxmin_system, nw_link,
-                        nw_link->bw_current);
+                        bandwidth_factor*nw_link->bw_current);
 
   if (policy == SURF_LINK_FATPIPE)
     lmm_constraint_shared(nw_link->constraint);
@@ -435,7 +437,7 @@ static void update_resource_state(void *id,
   if (event_type == nw_link->bw_event) {
     nw_link->bw_current = value;
     lmm_update_constraint_bound(network_maxmin_system, nw_link->constraint,
-                               nw_link->bw_current);
+                               bandwidth_factor*nw_link->bw_current);
   } else if (event_type == nw_link->lat_event) {
     double delta = value - nw_link->lat_current;
     lmm_variable_t var = NULL;
@@ -454,15 +456,14 @@ static void update_resource_state(void *id,
                                                      lat_current));
       else
        lmm_update_variable_bound(network_maxmin_system, action->variable,
-                                 min(action->rate*alpha_legrandvelho,
+                                 min(action->rate,
                                      SG_TCP_CTE_GAMMA / (2.0 *
                                                          action->
                                                          lat_current)));
       if (!(action->suspended))
        lmm_update_variable_weight(network_maxmin_system, action->variable,
                                   action->lat_current);
-      lmm_update_variable_latency(network_maxmin_system, action->variable,
-                                 delta);
+
     }
   } else if (event_type == nw_link->state_event) {
     if (value > 0)
@@ -544,6 +545,8 @@ static surf_action_t communicate(void *src, void *dst, double size,
   /* LARGE PLATFORMS HACK:
      Add src->link and dst->link latencies */
   action->lat_current = action->latency;
+  action->latency *= latency_factor;
+
 
   /* LARGE PLATFORMS HACK:
      lmm_variable_new(..., total_route_size)*/
@@ -567,16 +570,14 @@ static surf_action_t communicate(void *src, void *dst, double size,
   } else {
     if (action->lat_current > 0)
       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                               min(action->rate*alpha_legrandvelho,
+                               min(action->rate,
                                    SG_TCP_CTE_GAMMA / (2.0 *
                                                        action->
                                                        lat_current)));
     else
       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                               action->rate*alpha_legrandvelho);
+                               action->rate);
   }
-  lmm_update_variable_latency(network_maxmin_system, action->variable,
-                             action->latency);
 
   for (i = 0; i < route_size; i++)
     lmm_expand(network_maxmin_system, route[i]->constraint,
@@ -768,23 +769,25 @@ static void surf_network_model_init_internal(void)
     network_maxmin_system = lmm_system_new();
 }
 
-/***************************************************************************/
-/* New TCP sharing model based on thesis experimantation and discussions.  */
-/***************************************************************************/
+/************************************************************************/
+/* New model based on optimizations discussed during this thesis        */
+/************************************************************************/
 void surf_network_model_init_LegrandVelho(const char *filename)
 {
+
   if (surf_network_model)
     return;
   surf_network_model_init_internal();
   define_callbacks(filename);
   xbt_dynar_push(model_list, &surf_network_model);
   network_solve = lmm_solve;
-  alpha_legrandvelho = 0.92;
-  beta_legrandvelho = 10.4;
+
+  latency_factor = 10.4;
+  bandwidth_factor = 0.92;
+
   update_model_description(surf_network_model_description,
                           "LegrandVelho",
                           (surf_model_t) surf_network_model);
-  INFO0("LegrandVelho Model was chosen!!");
 }
 
 /***************************************************************************/