Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do not declare variable in the middle of nowhere!
[simgrid.git] / src / surf / network.c
1 /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "network_private.h"
8 #include "xbt/log.h"
9 #include "xbt/str.h"
10
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
12                                 "Logging specific to the SURF network module");
13
14 surf_model_t surf_network_model = NULL;
15 static lmm_system_t network_maxmin_system = NULL;
16 static void (*network_solve) (lmm_system_t) = NULL;
17
18 double sg_latency_factor = 1.0;    /* default value; can be set by model or from command line */
19 double sg_bandwidth_factor = 1.0;  /* default value; can be set by model or from command line */
20 double sg_weight_S_parameter = 0.0;/* default value; can be set by model or from command line */
21
22 double sg_tcp_gamma = 0.0;
23
24
25 static link_CM02_t net_link_new(char *name,
26                             double bw_initial,
27                             tmgr_trace_t bw_trace,
28                             double lat_initial,
29                             tmgr_trace_t lat_trace,
30                             e_surf_resource_state_t
31                             state_initial,
32                             tmgr_trace_t state_trace,
33                             e_surf_link_sharing_policy_t
34                             policy, xbt_dict_t properties)
35 {
36   link_CM02_t nw_link = (link_CM02_t)
37     surf_resource_lmm_new(sizeof(s_link_CM02_t),
38                           surf_network_model, name, properties,
39                           network_maxmin_system,
40                           sg_bandwidth_factor * bw_initial,
41                           history,
42                           state_initial, state_trace,
43                           bw_initial, bw_trace);
44
45   xbt_assert1(!xbt_dict_get_or_null(surf_network_model->resource_set, name),
46               "Link '%s' declared several times in the platform file.", name);
47
48   nw_link->lat_current = lat_initial;
49   if (lat_trace)
50     nw_link->lat_event =
51       tmgr_history_add_trace(history, lat_trace, 0.0, 0, nw_link);
52
53   if (policy == SURF_LINK_FATPIPE)
54     lmm_constraint_shared(nw_link->lmm_resource.constraint);
55
56   xbt_dict_set(surf_network_model->resource_set, name, nw_link,
57                surf_resource_free);
58 #ifdef HAVE_TRACING
59   TRACE_surf_link_declaration (name, bw_initial, lat_initial);
60 #endif
61
62   return nw_link;
63 }
64
65 static void net_parse_link_init(void)
66 {
67   char *name_link;
68   double bw_initial;
69   tmgr_trace_t bw_trace;
70   double lat_initial;
71   tmgr_trace_t lat_trace;
72   e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
73   e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
74   tmgr_trace_t state_trace;
75
76   name_link = xbt_strdup(A_surfxml_link_id);
77   surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
78   bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
79   surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
80   lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
81
82   xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
83               || (A_surfxml_link_state ==
84                   A_surfxml_link_state_OFF), "Invalid state");
85   if (A_surfxml_link_state == A_surfxml_link_state_ON)
86     state_initial_link = SURF_RESOURCE_ON;
87   else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
88     state_initial_link = SURF_RESOURCE_OFF;
89
90   if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
91     policy_initial_link = SURF_LINK_SHARED;
92   else if (A_surfxml_link_sharing_policy ==
93            A_surfxml_link_sharing_policy_FATPIPE)
94     policy_initial_link = SURF_LINK_FATPIPE;
95
96   state_trace = tmgr_trace_new(A_surfxml_link_state_file);
97
98   net_link_new(name_link, bw_initial, bw_trace,
99            lat_initial, lat_trace, state_initial_link, state_trace,
100            policy_initial_link, xbt_dict_new());
101
102 }
103
104 static void net_add_traces(void)
105 {
106   xbt_dict_cursor_t cursor = NULL;
107   char *trace_name, *elm;
108
109   static int called = 0;
110   if (called)
111     return;
112   called = 1;
113
114   /* connect all traces relative to network */
115   xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
116     tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
117     link_CM02_t link =
118       xbt_dict_get_or_null(surf_network_model->resource_set, elm);
119
120     xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
121                 trace_name, elm);
122     xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined",
123                 trace_name, elm);
124
125     link->lmm_resource.state_event =
126       tmgr_history_add_trace(history, trace, 0.0, 0, link);
127   }
128
129   xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
130     tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
131     link_CM02_t link =
132       xbt_dict_get_or_null(surf_network_model->resource_set, elm);
133
134     xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
135                 trace_name, elm);
136     xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined",
137                 trace_name, elm);
138
139     link->lmm_resource.power.event =
140       tmgr_history_add_trace(history, trace, 0.0, 0, link);
141   }
142
143   xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
144     tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
145     link_CM02_t link =
146       xbt_dict_get_or_null(surf_network_model->resource_set, elm);
147
148     xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
149                 trace_name, elm);
150     xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined",
151                 trace_name, elm);
152
153     link->lat_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
154   }
155 }
156
157 static void net_define_callbacks(const char *file)
158 {
159   /* Figuring out the network links */
160   surfxml_add_callback(STag_surfxml_link_cb_list, &net_parse_link_init);
161   surfxml_add_callback(ETag_surfxml_platform_cb_list, &net_add_traces);
162 }
163
164 static int net_resource_used(void *resource_id)
165 {
166   return lmm_constraint_used(network_maxmin_system,
167                              ((surf_resource_lmm_t) resource_id)->constraint);
168 }
169
170 static int net_action_unref(surf_action_t action)
171 {
172   action->refcount--;
173   if (!action->refcount) {
174     xbt_swag_remove(action, action->state_set);
175     if (((surf_action_network_CM02_t) action)->variable)
176       lmm_variable_free(network_maxmin_system,
177                         ((surf_action_network_CM02_t) action)->variable);
178     free(action);
179     return 1;
180   }
181   return 0;
182 }
183
184 static void net_action_cancel(surf_action_t action)
185 {
186   surf_network_model->action_state_set((surf_action_t) action,
187                                        SURF_ACTION_FAILED);
188   return;
189 }
190
191 static void net_action_recycle(surf_action_t action)
192 {
193   return;
194 }
195
196 static double net_action_get_remains(surf_action_t action)
197 {
198   return action->remains;
199 }
200
201 static double net_share_resources(double now)
202 {
203   s_surf_action_network_CM02_t s_action;
204   surf_action_network_CM02_t action = NULL;
205   xbt_swag_t running_actions = surf_network_model->states.running_action_set;
206   double min;
207
208   min = generic_maxmin_share_resources(running_actions,
209                                        xbt_swag_offset(s_action,
210                                                        variable),
211                                        network_maxmin_system, network_solve);
212
213 #define VARIABLE(action) (*((lmm_variable_t*)(((char *) (action)) + xbt_swag_offset(s_action, variable)  )))
214
215   xbt_swag_foreach(action, running_actions) {
216     if (action->latency > 0) {
217       if (min < 0)
218         min = action->latency;
219       else if (action->latency < min)
220         min = action->latency;
221     }
222   }
223
224   return min;
225 }
226
227 static void net_update_actions_state(double now, double delta)
228 {
229   double deltap = 0.0;
230   surf_action_network_CM02_t action = NULL;
231   surf_action_network_CM02_t next_action = NULL;
232   xbt_swag_t running_actions = surf_network_model->states.running_action_set;
233   /*
234      xbt_swag_t failed_actions =
235      surf_network_model->states.failed_action_set;
236    */
237
238   xbt_swag_foreach_safe(action, next_action, running_actions) {
239
240 #ifdef HAVE_TRACING
241     xbt_dynar_t route = used_routing->get_route(action->src, action->dst);
242     link_CM02_t link;
243     unsigned int i;
244     xbt_dynar_foreach(route, i, link) {
245         TRACE_surf_link_set_utilization (link->lmm_resource.generic_resource.name,
246           action->generic_action.data, lmm_variable_getvalue(action->variable), now-delta, delta);
247     }
248 #endif
249
250     deltap = delta;
251     if (action->latency > 0) {
252       if (action->latency > deltap) {
253         double_update(&(action->latency), deltap);
254         deltap = 0.0;
255       } else {
256         double_update(&(deltap), action->latency);
257         action->latency = 0.0;
258       }
259       if ((action->latency == 0.0) && !(action->suspended))
260         lmm_update_variable_weight(network_maxmin_system, action->variable,
261                                    action->weight);
262     }
263     double_update(&(action->generic_action.remains),
264                   lmm_variable_getvalue(action->variable) * deltap);
265     if (action->generic_action.max_duration != NO_MAX_DURATION)
266       double_update(&(action->generic_action.max_duration), delta);
267
268     if ((action->generic_action.remains <= 0) &&
269         (lmm_get_variable_weight(action->variable) > 0)) {
270       action->generic_action.finish = surf_get_clock();
271       surf_network_model->action_state_set((surf_action_t) action,
272                                            SURF_ACTION_DONE);
273     } else if ((action->generic_action.max_duration != NO_MAX_DURATION)
274                && (action->generic_action.max_duration <= 0)) {
275       action->generic_action.finish = surf_get_clock();
276       surf_network_model->action_state_set((surf_action_t) action,
277                                            SURF_ACTION_DONE);
278     }
279   }
280
281   return;
282 }
283
284 static void net_update_resource_state(void *id,
285                                   tmgr_trace_event_t event_type,
286                                   double value, double date)
287 {
288   link_CM02_t nw_link = id;
289   /*   printf("[" "%lg" "] Asking to update network card \"%s\" with value " */
290   /*     "%lg" " for event %p\n", surf_get_clock(), nw_link->name, */
291   /*     value, event_type); */
292
293   if (event_type == nw_link->lmm_resource.power.event) {
294     double delta =
295       sg_weight_S_parameter / value - sg_weight_S_parameter /
296       (nw_link->lmm_resource.power.peak * nw_link->lmm_resource.power.scale);
297     lmm_variable_t var = NULL;
298     lmm_element_t elem = NULL;
299     surf_action_network_CM02_t action = NULL;
300
301     nw_link->lmm_resource.power.peak = value;
302     lmm_update_constraint_bound(network_maxmin_system,
303                                 nw_link->lmm_resource.constraint,
304                                 sg_bandwidth_factor *
305                                 (nw_link->lmm_resource.power.peak *
306                                  nw_link->lmm_resource.power.scale));
307 #ifdef HAVE_TRACING
308     TRACE_surf_link_set_bandwidth (date, nw_link->lmm_resource.generic_resource.name, sg_bandwidth_factor * (nw_link->lmm_resource.power.peak * nw_link->lmm_resource.power.scale));
309 #endif
310     if (sg_weight_S_parameter > 0) {
311       while ((var = lmm_get_var_from_cnst
312               (network_maxmin_system, nw_link->lmm_resource.constraint,
313                &elem))) {
314         action = lmm_variable_id(var);
315         action->weight += delta;
316         if (!(action->suspended))
317           lmm_update_variable_weight(network_maxmin_system, action->variable,
318                                      action->weight);
319       }
320     }
321     if (tmgr_trace_event_free(event_type))
322       nw_link->lmm_resource.power.event = NULL;
323   } else if (event_type == nw_link->lat_event) {
324     double delta = value - nw_link->lat_current;
325     lmm_variable_t var = NULL;
326     lmm_element_t elem = NULL;
327     surf_action_network_CM02_t action = NULL;
328
329     nw_link->lat_current = value;
330     while ((var = lmm_get_var_from_cnst
331             (network_maxmin_system, nw_link->lmm_resource.constraint,
332              &elem))) {
333       action = lmm_variable_id(var);
334       action->lat_current += delta;
335       action->weight += delta;
336       if (action->rate < 0)
337         lmm_update_variable_bound(network_maxmin_system, action->variable,
338                                   sg_tcp_gamma / (2.0 * action->lat_current));
339       else
340         lmm_update_variable_bound(network_maxmin_system, action->variable,
341                                   min(action->rate,
342                                       sg_tcp_gamma / (2.0 *
343                                                       action->lat_current)));
344       if (!(action->suspended))
345         lmm_update_variable_weight(network_maxmin_system, action->variable,
346                                    action->weight);
347
348     }
349     if (tmgr_trace_event_free(event_type))
350       nw_link->lat_event = NULL;
351   } else if (event_type == nw_link->lmm_resource.state_event) {
352     if (value > 0)
353       nw_link->lmm_resource.state_current = SURF_RESOURCE_ON;
354     else {
355       lmm_constraint_t cnst = nw_link->lmm_resource.constraint;
356       lmm_variable_t var = NULL;
357       lmm_element_t elem = NULL;
358
359       nw_link->lmm_resource.state_current = SURF_RESOURCE_OFF;
360       while ((var = lmm_get_var_from_cnst
361               (network_maxmin_system, cnst, &elem))) {
362         surf_action_t action = lmm_variable_id(var);
363
364         if (surf_action_state_get(action) == SURF_ACTION_RUNNING ||
365             surf_action_state_get(action) == SURF_ACTION_READY) {
366           action->finish = date;
367           surf_network_model->action_state_set(action, SURF_ACTION_FAILED);
368         }
369       }
370     }
371     if (tmgr_trace_event_free(event_type))
372       nw_link->lmm_resource.state_event = NULL;
373   } else {
374     CRITICAL0("Unknown event ! \n");
375     xbt_abort();
376   }
377
378   return;
379 }
380
381 static surf_action_t net_communicate(const char *src_name, const char *dst_name,
382                                  int src, int dst, double size, double rate)
383 {
384   unsigned int i;
385   link_CM02_t link;
386   int failed = 0;
387   surf_action_network_CM02_t action = NULL;
388   /* LARGE PLATFORMS HACK:
389      Add a link_CM02_t *link and a int link_nb to network_card_CM02_t. It will represent local links for this node
390      Use the cluster_id for ->id */
391   xbt_dynar_t route = used_routing->get_route(src, dst);
392   /* LARGE PLATFORMS HACK:
393      total_route_size = route_size + src->link_nb + dst->nb */
394
395   XBT_IN4("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
396   /* LARGE PLATFORMS HACK:
397      assert on total_route_size */
398   xbt_assert2(xbt_dynar_length(route),
399               "You're trying to send data from %s to %s but there is no connection between these two hosts.",
400               src_name, dst_name);
401
402   xbt_dynar_foreach(route, i, link) {
403     if (link->lmm_resource.state_current == SURF_RESOURCE_OFF) {
404       failed = 1;
405       break;
406     }
407   }
408   action =
409     surf_action_new(sizeof(s_surf_action_network_CM02_t), size,
410                     surf_network_model, failed);
411
412   xbt_swag_insert(action, action->generic_action.state_set);
413   action->rate = rate;
414
415   action->latency = 0.0;
416   action->weight = 0.0;
417   xbt_dynar_foreach(route, i, link) {
418     action->latency += link->lat_current;
419     action->weight +=
420       link->lat_current +
421       sg_weight_S_parameter /
422       (link->lmm_resource.power.peak * link->lmm_resource.power.scale);
423   }
424   /* LARGE PLATFORMS HACK:
425      Add src->link and dst->link latencies */
426   action->lat_current = action->latency;
427   action->latency *= sg_latency_factor;
428
429   /* LARGE PLATFORMS HACK:
430      lmm_variable_new(..., total_route_size) */
431   if (action->latency > 0)
432     action->variable =
433       lmm_variable_new(network_maxmin_system, action, 0.0, -1.0,
434                        xbt_dynar_length(route));
435   else
436     action->variable =
437       lmm_variable_new(network_maxmin_system, action, 1.0, -1.0,
438                        xbt_dynar_length(route));
439
440   if (action->rate < 0) {
441     if (action->lat_current > 0)
442       lmm_update_variable_bound(network_maxmin_system, action->variable,
443                                 sg_tcp_gamma / (2.0 * action->lat_current));
444     else
445       lmm_update_variable_bound(network_maxmin_system, action->variable,
446                                 -1.0);
447   } else {
448     if (action->lat_current > 0)
449       lmm_update_variable_bound(network_maxmin_system, action->variable,
450                                 min(action->rate,
451                                     sg_tcp_gamma / (2.0 *
452                                                     action->lat_current)));
453     else
454       lmm_update_variable_bound(network_maxmin_system, action->variable,
455                                 action->rate);
456   }
457
458   xbt_dynar_foreach(route, i, link) {
459     lmm_expand(network_maxmin_system, link->lmm_resource.constraint,
460                action->variable, 1.0);
461   }
462   /* LARGE PLATFORMS HACK:
463      expand also with src->link and dst->link */
464
465   /* saving the src and dst of this communication */
466   action->src = src;
467   action->dst = dst;
468
469   XBT_OUT;
470
471   return (surf_action_t) action;
472 }
473
474 static double net_get_link_bandwidth(const void *link)
475 {
476   surf_resource_lmm_t lmm = (surf_resource_lmm_t) link;
477   return lmm->power.peak * lmm->power.scale;
478 }
479
480 static double net_get_link_latency(const void *link)
481 {
482   return ((link_CM02_t) link)->lat_current;
483 }
484
485 static int net_link_shared(const void *link)
486 {
487   return lmm_constraint_is_shared(((surf_resource_lmm_t) link)->constraint);
488 }
489
490 static void net_action_suspend(surf_action_t action)
491 {
492   ((surf_action_network_CM02_t) action)->suspended = 1;
493   lmm_update_variable_weight(network_maxmin_system,
494                              ((surf_action_network_CM02_t) action)->variable,
495                              0.0);
496 }
497
498 static void net_action_resume(surf_action_t action)
499 {
500   if (((surf_action_network_CM02_t) action)->suspended) {
501     lmm_update_variable_weight(network_maxmin_system,
502                                ((surf_action_network_CM02_t)
503                                 action)->variable,
504                                ((surf_action_network_CM02_t) action)->weight);
505     ((surf_action_network_CM02_t) action)->suspended = 0;
506   }
507 }
508
509 static int net_action_is_suspended(surf_action_t action)
510 {
511   return ((surf_action_network_CM02_t) action)->suspended;
512 }
513
514 static void net_action_set_max_duration(surf_action_t action, double duration)
515 {
516   action->max_duration = duration;
517 }
518
519 static void net_finalize(void)
520 {
521   surf_model_exit(surf_network_model);
522   surf_network_model = NULL;
523
524   used_routing->finalize();
525   lmm_system_free(network_maxmin_system);
526   network_maxmin_system = NULL;
527 }
528
529 static void surf_network_model_init_internal(void)
530 {
531   surf_network_model = surf_model_init();
532
533   surf_network_model->name = "network";
534   surf_network_model->action_unref = net_action_unref;
535   surf_network_model->action_cancel = net_action_cancel;
536   surf_network_model->action_recycle = net_action_recycle;
537   surf_network_model->get_remains = net_action_get_remains;
538
539   surf_network_model->model_private->resource_used = net_resource_used;
540   surf_network_model->model_private->share_resources = net_share_resources;
541   surf_network_model->model_private->update_actions_state =
542     net_update_actions_state;
543   surf_network_model->model_private->update_resource_state =
544     net_update_resource_state;
545   surf_network_model->model_private->finalize = net_finalize;
546
547   surf_network_model->suspend = net_action_suspend;
548   surf_network_model->resume = net_action_resume;
549   surf_network_model->is_suspended = net_action_is_suspended;
550   surf_cpu_model->set_max_duration = net_action_set_max_duration;
551
552   surf_network_model->extension.network.communicate = net_communicate;
553   surf_network_model->extension.network.get_link_bandwidth =
554     net_get_link_bandwidth;
555   surf_network_model->extension.network.get_link_latency = net_get_link_latency;
556   surf_network_model->extension.network.link_shared = net_link_shared;
557
558   if (!network_maxmin_system)
559     network_maxmin_system = lmm_system_new();
560
561   routing_model_create(sizeof(link_CM02_t),
562                        net_link_new(xbt_strdup("__loopback__"),
563                                 498000000, NULL, 0.000015, NULL,
564                                 SURF_RESOURCE_ON, NULL, SURF_LINK_FATPIPE,
565                                 NULL));
566 }
567
568 /************************************************************************/
569 /* New model based on optimizations discussed during this thesis        */
570 /************************************************************************/
571 void surf_network_model_init_LegrandVelho(const char *filename)
572 {
573
574   if (surf_network_model)
575     return;
576   surf_network_model_init_internal();
577   net_define_callbacks(filename);
578   xbt_dynar_push(model_list, &surf_network_model);
579   network_solve = lmm_solve;
580
581   xbt_cfg_setdefault_double(_surf_cfg_set,"network/latency_factor",10.4);
582   xbt_cfg_setdefault_double(_surf_cfg_set,"network/bandwidth_factor", 0.92);
583   xbt_cfg_setdefault_double(_surf_cfg_set,"network/weight_S", 8775);
584
585   update_model_description(surf_network_model_description,
586                            "LV08", surf_network_model);
587 }
588
589 /***************************************************************************/
590 /* The nice TCP sharing model designed by Loris Marchal and Henri Casanova */
591 /***************************************************************************/
592 /* @TechReport{      rr-lip2002-40, */
593 /*   author        = {Henri Casanova and Loris Marchal}, */
594 /*   institution   = {LIP}, */
595 /*   title         = {A Network Model for Simulation of Grid Application}, */
596 /*   number        = {2002-40}, */
597 /*   month         = {oct}, */
598 /*   year          = {2002} */
599 /* } */
600 void surf_network_model_init_CM02(const char *filename)
601 {
602
603   if (surf_network_model)
604     return;
605   surf_network_model_init_internal();
606   net_define_callbacks(filename);
607   xbt_dynar_push(model_list, &surf_network_model);
608   network_solve = lmm_solve;
609
610   update_model_description(surf_network_model_description,
611                            "CM02", surf_network_model);
612 }
613
614 void surf_network_model_init_Reno(const char *filename)
615 {
616   if (surf_network_model)
617     return;
618   surf_network_model_init_internal();
619   net_define_callbacks(filename);
620
621   xbt_dynar_push(model_list, &surf_network_model);
622   lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi);
623   network_solve = lagrange_solve;
624
625   xbt_cfg_setdefault_double(_surf_cfg_set,"network/latency_factor", 10.4);
626   xbt_cfg_setdefault_double(_surf_cfg_set,"network/bandwidth_factor", 0.92);
627   xbt_cfg_setdefault_double(_surf_cfg_set,"network/weight_S", 8775);
628
629   update_model_description(surf_network_model_description,
630                            "Reno", surf_network_model);
631 }
632
633
634 void surf_network_model_init_Reno2(const char *filename)
635 {
636   if (surf_network_model)
637     return;
638   surf_network_model_init_internal();
639   net_define_callbacks(filename);
640
641   xbt_dynar_push(model_list, &surf_network_model);
642   lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp,
643                                     func_reno2_fpi);
644   network_solve = lagrange_solve;
645
646   xbt_cfg_setdefault_double(_surf_cfg_set,"network/latency_factor", 10.4);
647   xbt_cfg_setdefault_double(_surf_cfg_set,"network/bandwidth_factor", 0.92);
648   xbt_cfg_setdefault_double(_surf_cfg_set,"network/weight_S_parameter", 8775);
649
650   update_model_description(surf_network_model_description,
651                            "Reno2", surf_network_model);
652 }
653
654 void surf_network_model_init_Vegas(const char *filename)
655 {
656   if (surf_network_model)
657     return;
658   surf_network_model_init_internal();
659   net_define_callbacks(filename);
660
661   xbt_dynar_push(model_list, &surf_network_model);
662   lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
663                                     func_vegas_fpi);
664   network_solve = lagrange_solve;
665
666   xbt_cfg_setdefault_double(_surf_cfg_set,"network/latency_factor", 10.4);
667   xbt_cfg_setdefault_double(_surf_cfg_set,"network/bandwidth_factor", 0.92);
668   xbt_cfg_setdefault_double(_surf_cfg_set,"network/weight_S", 8775);
669
670   update_model_description(surf_network_model_description,
671                            "Vegas", surf_network_model);
672 }