Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1956c71631c36b105804a2a674c225c4186c3b10
[simgrid.git] / src / surf / network.c
1 /*      $Id$     */
2
3 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved.                  */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #include "network_private.h"
9 #include "xbt/log.h"
10
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
12                                 "Logging specific to the SURF network module");
13
14 surf_network_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 xbt_dict_t network_link_set = NULL;
19 xbt_dict_t network_card_set = NULL;
20
21 int card_number = 0;
22 network_link_CM02_t **routing_table = NULL;
23 int *routing_table_size = NULL;
24 static network_link_CM02_t loopback = NULL;
25
26 static void create_routing_table(void)
27 {
28   routing_table =
29       xbt_new0(network_link_CM02_t *, card_number * card_number);
30   routing_table_size = xbt_new0(int, card_number * card_number);
31 }
32
33 static void network_link_free(void *nw_link)
34 {
35   free(((network_link_CM02_t) nw_link)->name);
36   free(nw_link);
37 }
38
39 static network_link_CM02_t network_link_new(char *name,
40                                             double bw_initial,
41                                             tmgr_trace_t bw_trace,
42                                             double lat_initial,
43                                             tmgr_trace_t lat_trace,
44                                             e_surf_network_link_state_t
45                                             state_initial,
46                                             tmgr_trace_t state_trace,
47                                             e_surf_network_link_sharing_policy_t
48                                             policy)
49 {
50   network_link_CM02_t nw_link = xbt_new0(s_network_link_CM02_t, 1);
51
52
53   nw_link->model = (surf_model_t) surf_network_model;
54   nw_link->name = name;
55   nw_link->bw_current = bw_initial;
56   if (bw_trace)
57     nw_link->bw_event =
58         tmgr_history_add_trace(history, bw_trace, 0.0, 0, nw_link);
59   nw_link->lat_current = lat_initial;
60   if (lat_trace)
61     nw_link->lat_event =
62         tmgr_history_add_trace(history, lat_trace, 0.0, 0, nw_link);
63   nw_link->state_current = state_initial;
64   if (state_trace)
65     nw_link->state_event =
66         tmgr_history_add_trace(history, state_trace, 0.0, 0, nw_link);
67
68   nw_link->constraint =
69       lmm_constraint_new(network_maxmin_system, nw_link,
70                          nw_link->bw_current);
71
72   if (policy == SURF_NETWORK_LINK_FATPIPE)
73     lmm_constraint_shared(nw_link->constraint);
74
75   xbt_dict_set(network_link_set, name, nw_link, network_link_free);
76
77   return nw_link;
78 }
79
80 static void network_card_free(void *nw_card)
81 {
82   free(((network_card_CM02_t) nw_card)->name);
83   free(nw_card);
84 }
85
86 static int network_card_new(const char *card_name)
87 {
88   network_card_CM02_t card =
89       xbt_dict_get_or_null(network_card_set, card_name);
90
91   if (!card) {
92     card = xbt_new0(s_network_card_CM02_t, 1);
93     card->name = xbt_strdup(card_name);
94     card->id = card_number++;
95     xbt_dict_set(network_card_set, card_name, card, network_card_free);
96   }
97   return card->id;
98 }
99
100 static void route_new(int src_id, int dst_id,
101                       network_link_CM02_t * link_list, int nb_link)
102 {
103   ROUTE_SIZE(src_id, dst_id) = nb_link;
104   ROUTE(src_id, dst_id) = link_list =
105       xbt_realloc(link_list, sizeof(network_link_CM02_t) * nb_link);
106 }
107
108 static void parse_network_link(void)
109 {
110   char *name;
111   double bw_initial;
112   tmgr_trace_t bw_trace;
113   double lat_initial;
114   tmgr_trace_t lat_trace;
115   e_surf_network_link_state_t state_initial = SURF_NETWORK_LINK_ON;
116   e_surf_network_link_sharing_policy_t policy_initial =
117       SURF_NETWORK_LINK_SHARED;
118   tmgr_trace_t state_trace;
119
120   name = xbt_strdup(A_surfxml_network_link_name);
121   surf_parse_get_double(&bw_initial, A_surfxml_network_link_bandwidth);
122   surf_parse_get_trace(&bw_trace, A_surfxml_network_link_bandwidth_file);
123   surf_parse_get_double(&lat_initial, A_surfxml_network_link_latency);
124   surf_parse_get_trace(&lat_trace, A_surfxml_network_link_latency_file);
125
126   xbt_assert0((A_surfxml_network_link_state ==
127                A_surfxml_network_link_state_ON)
128               || (A_surfxml_network_link_state ==
129                   A_surfxml_network_link_state_OFF), "Invalid state");
130   if (A_surfxml_network_link_state == A_surfxml_network_link_state_ON)
131     state_initial = SURF_NETWORK_LINK_ON;
132   else if (A_surfxml_network_link_state ==
133            A_surfxml_network_link_state_OFF)
134     state_initial = SURF_NETWORK_LINK_OFF;
135
136   if (A_surfxml_network_link_sharing_policy ==
137       A_surfxml_network_link_sharing_policy_SHARED)
138     policy_initial = SURF_NETWORK_LINK_SHARED;
139   else if (A_surfxml_network_link_sharing_policy ==
140            A_surfxml_network_link_sharing_policy_FATPIPE)
141     policy_initial = SURF_NETWORK_LINK_FATPIPE;
142
143   surf_parse_get_trace(&state_trace, A_surfxml_network_link_state_file);
144
145   network_link_new(name, bw_initial, bw_trace,
146                    lat_initial, lat_trace, state_initial, state_trace,
147                    policy_initial);
148 }
149
150 static int nb_link;
151 static int link_list_capacity;
152 static network_link_CM02_t *link_list = NULL;
153 static int src_id = -1;
154 static int dst_id = -1;
155
156 static void parse_route_set_endpoints(void)
157 {
158   src_id = network_card_new(A_surfxml_route_src);
159   dst_id = network_card_new(A_surfxml_route_dst);
160   nb_link = 0;
161   link_list_capacity = 20;
162   link_list = xbt_new(network_link_CM02_t, link_list_capacity);
163 }
164
165 static void parse_route_elem(void)
166 {
167   if (nb_link == link_list_capacity) {
168     link_list_capacity *= 2;
169     link_list =
170         xbt_realloc(link_list,
171                     (link_list_capacity) * sizeof(network_link_CM02_t));
172   }
173   link_list[nb_link++] =
174       xbt_dict_get_or_null(network_link_set, A_surfxml_route_element_name);
175 }
176
177 static void parse_route_set_route(void)
178 {
179   route_new(src_id, dst_id, link_list, nb_link);
180 }
181
182 static void parse_file(const char *file)
183 {
184   int i;
185
186   /* Figuring out the network links */
187   surf_parse_reset_parser();
188   ETag_surfxml_network_link_fun = parse_network_link;
189   surf_parse_open(file);
190   xbt_assert1((!surf_parse()), "Parse error in %s", file);
191   surf_parse_close();
192
193   /* Figuring out the network cards used */
194   surf_parse_reset_parser();
195   STag_surfxml_route_fun = parse_route_set_endpoints;
196   surf_parse_open(file);
197   xbt_assert1((!surf_parse()), "Parse error in %s", file);
198   surf_parse_close();
199
200   create_routing_table();
201
202   /* Building the routes */
203   surf_parse_reset_parser();
204   STag_surfxml_route_fun = parse_route_set_endpoints;
205   ETag_surfxml_route_element_fun = parse_route_elem;
206   ETag_surfxml_route_fun = parse_route_set_route;
207   surf_parse_open(file);
208   xbt_assert1((!surf_parse()), "Parse error in %s", file);
209   surf_parse_close();
210
211   /* Adding loopback if needed */
212
213   for (i = 0; i < card_number; i++)
214     if (!ROUTE_SIZE(i, i)) {
215       if (!loopback)
216         loopback = network_link_new(xbt_strdup("__MSG_loopback__"),
217                                     498000000, NULL, 0.000015, NULL,
218                                     SURF_NETWORK_LINK_ON, NULL,
219                                     SURF_NETWORK_LINK_FATPIPE);
220       ROUTE_SIZE(i, i) = 1;
221       ROUTE(i, i) = xbt_new0(network_link_CM02_t, 1);
222       ROUTE(i, i)[0] = loopback;
223     }
224 }
225
226 static void *name_service(const char *name)
227 {
228   network_card_CM02_t card = xbt_dict_get_or_null(network_card_set, name);
229   return card;
230 }
231
232 static const char *get_resource_name(void *resource_id)
233 {
234   return ((network_card_CM02_t) resource_id)->name;
235 }
236
237 static int resource_used(void *resource_id)
238 {
239   return lmm_constraint_used(network_maxmin_system,
240                              ((network_link_CM02_t) resource_id)->
241                              constraint);
242 }
243
244 static int action_free(surf_action_t action)
245 {
246   action->using--;
247   if (!action->using) {
248     xbt_swag_remove(action, action->state_set);
249     if (((surf_action_network_CM02_t) action)->variable)
250       lmm_variable_free(network_maxmin_system,
251                         ((surf_action_network_CM02_t) action)->variable);
252     free(action);
253     return 1;
254   }
255   return 0;
256 }
257
258 static void action_use(surf_action_t action)
259 {
260   action->using++;
261 }
262
263 static void action_cancel(surf_action_t action)
264 {
265   return;
266 }
267
268 static void action_recycle(surf_action_t action)
269 {
270   return;
271 }
272
273 static void action_change_state(surf_action_t action,
274                                 e_surf_action_state_t state)
275 {
276 /*   if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
277 /*     if(((surf_action_network_CM02_t)action)->variable) { */
278 /*       lmm_variable_disable(network_maxmin_system, ((surf_action_network_CM02_t)action)->variable); */
279 /*       ((surf_action_network_CM02_t)action)->variable = NULL; */
280 /*     } */
281
282   surf_action_change_state(action, state);
283   return;
284 }
285
286 static double share_resources(double now)
287 {
288   s_surf_action_network_CM02_t s_action;
289   surf_action_network_CM02_t action = NULL;
290   xbt_swag_t running_actions =
291       surf_network_model->common_public->states.running_action_set;
292   double min;
293
294   min = generic_maxmin_share_resources2(running_actions,
295                                         xbt_swag_offset(s_action,
296                                                         variable),
297                                         network_maxmin_system,
298                                         network_solve);
299
300   xbt_swag_foreach(action, running_actions) {
301     if (action->latency > 0) {
302       if (min < 0)
303         min = action->latency;
304       else if (action->latency < min)
305         min = action->latency;
306     }
307   }
308
309   return min;
310 }
311
312 static void update_actions_state(double now, double delta)
313 {
314   double deltap = 0.0;
315   surf_action_network_CM02_t action = NULL;
316   surf_action_network_CM02_t next_action = NULL;
317   xbt_swag_t running_actions =
318       surf_network_model->common_public->states.running_action_set;
319   /*
320      xbt_swag_t failed_actions =
321      surf_network_model->common_public->states.failed_action_set;
322    */
323
324   xbt_swag_foreach_safe(action, next_action, running_actions) {
325     deltap = delta;
326     if (action->latency > 0) {
327       if (action->latency > deltap) {
328         double_update(&(action->latency), deltap);
329         deltap = 0.0;
330       } else {
331         double_update(&(deltap), action->latency);
332         action->latency = 0.0;
333       }
334       if ((action->latency == 0.0) && !(action->suspended))
335         lmm_update_variable_weight(network_maxmin_system, action->variable,
336                                    action->lat_current);
337     }
338     double_update(&(action->generic_action.remains),
339                   lmm_variable_getvalue(action->variable) * deltap);
340     if (action->generic_action.max_duration != NO_MAX_DURATION)
341       double_update(&(action->generic_action.max_duration), delta);
342
343     /*   if(action->generic_action.remains<.00001) action->generic_action.remains=0; */
344
345     if ((action->generic_action.remains <= 0) &&
346         (lmm_get_variable_weight(action->variable) > 0)) {
347       action->generic_action.finish = surf_get_clock();
348       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
349     } else if ((action->generic_action.max_duration != NO_MAX_DURATION) &&
350                (action->generic_action.max_duration <= 0)) {
351       action->generic_action.finish = surf_get_clock();
352       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
353     } else {                    /* Need to check that none of the model has failed */
354       lmm_constraint_t cnst = NULL;
355       int i = 0;
356       network_link_CM02_t nw_link = NULL;
357
358       while ((cnst =
359               lmm_get_cnst_from_var(network_maxmin_system,
360                                     action->variable, i++))) {
361         nw_link = lmm_constraint_id(cnst);
362         if (nw_link->state_current == SURF_NETWORK_LINK_OFF) {
363           action->generic_action.finish = surf_get_clock();
364           action_change_state((surf_action_t) action, SURF_ACTION_FAILED);
365           break;
366         }
367       }
368     }
369   }
370
371   return;
372 }
373
374 static void update_resource_state(void *id,
375                                   tmgr_trace_event_t event_type,
376                                   double value)
377 {
378   network_link_CM02_t nw_link = id;
379   /*   printf("[" "%lg" "] Asking to update network card \"%s\" with value " */
380   /*     "%lg" " for event %p\n", surf_get_clock(), nw_link->name, */
381   /*     value, event_type); */
382
383   if (event_type == nw_link->bw_event) {
384     nw_link->bw_current = value;
385     lmm_update_constraint_bound(network_maxmin_system, nw_link->constraint,
386                                 nw_link->bw_current);
387   } else if (event_type == nw_link->lat_event) {
388     double delta = value - nw_link->lat_current;
389     lmm_variable_t var = NULL;
390     surf_action_network_CM02_t action = NULL;
391
392     nw_link->lat_current = value;
393     while (lmm_get_var_from_cnst
394            (network_maxmin_system, nw_link->constraint, &var)) {
395       action = lmm_variable_id(var);
396       action->lat_current += delta;
397       if (action->rate < 0)
398         lmm_update_variable_bound(network_maxmin_system, action->variable,
399                                   SG_TCP_CTE_GAMMA / (2.0 *
400                                                       action->
401                                                       lat_current));
402       else
403         lmm_update_variable_bound(network_maxmin_system, action->variable,
404                                   min(action->rate,
405                                       SG_TCP_CTE_GAMMA / (2.0 *
406                                                           action->
407                                                           lat_current)));
408       if (!(action->suspended))
409         lmm_update_variable_weight(network_maxmin_system, action->variable,
410                                    action->lat_current);
411       lmm_update_variable_latency(network_maxmin_system, action->variable,
412                                   delta);
413     }
414   } else if (event_type == nw_link->state_event) {
415     if (value > 0)
416       nw_link->state_current = SURF_NETWORK_LINK_ON;
417     else
418       nw_link->state_current = SURF_NETWORK_LINK_OFF;
419   } else {
420     CRITICAL0("Unknown event ! \n");
421     xbt_abort();
422   }
423
424   return;
425 }
426
427 static surf_action_t communicate(void *src, void *dst, double size,
428                                  double rate)
429 {
430   surf_action_network_CM02_t action = NULL;
431   network_card_CM02_t card_src = src;
432   network_card_CM02_t card_dst = dst;
433   int route_size = ROUTE_SIZE(card_src->id, card_dst->id);
434   network_link_CM02_t *route = ROUTE(card_src->id, card_dst->id);
435   int i;
436
437   XBT_IN4("(%s,%s,%g,%g)", card_src->name, card_dst->name, size, rate);
438   xbt_assert2(route_size,
439               "You're trying to send data from %s to %s but there is no connexion between these two cards.",
440               card_src->name, card_dst->name);
441
442   action = xbt_new0(s_surf_action_network_CM02_t, 1);
443
444   action->generic_action.using = 1;
445   action->generic_action.cost = size;
446   action->generic_action.remains = size;
447   action->generic_action.max_duration = NO_MAX_DURATION;
448   action->generic_action.start = surf_get_clock();
449   action->generic_action.finish = -1.0;
450   action->generic_action.model_type =
451       (surf_model_t) surf_network_model;
452   action->suspended = 0;        /* Should be useless because of the 
453                                    calloc but it seems to help valgrind... */
454   action->generic_action.state_set =
455       surf_network_model->common_public->states.running_action_set;
456
457   xbt_swag_insert(action, action->generic_action.state_set);
458   action->rate = rate;
459
460   action->latency = 0.0;
461   for (i = 0; i < route_size; i++)
462     action->latency += route[i]->lat_current;
463   action->lat_current = action->latency;
464
465   if (action->latency > 0)
466     action->variable =
467         lmm_variable_new(network_maxmin_system, action, 0.0, -1.0,
468                          route_size);
469   else
470     action->variable =
471         lmm_variable_new(network_maxmin_system, action, 1.0, -1.0,
472                          route_size);
473
474   if (action->rate < 0) {
475     if (action->lat_current > 0)
476       lmm_update_variable_bound(network_maxmin_system, action->variable,
477                                 SG_TCP_CTE_GAMMA / (2.0 *
478                                                     action->lat_current));
479     else
480       lmm_update_variable_bound(network_maxmin_system, action->variable,
481                                 -1.0);
482   } else {
483     if (action->lat_current > 0)
484       lmm_update_variable_bound(network_maxmin_system, action->variable,
485                                 min(action->rate,
486                                     SG_TCP_CTE_GAMMA / (2.0 *
487                                                         action->
488                                                         lat_current)));
489     else
490       lmm_update_variable_bound(network_maxmin_system, action->variable,
491                                 action->rate);
492   }
493   lmm_update_variable_latency(maxmin_system, action->variable,
494                               action->latency);
495
496   for (i = 0; i < route_size; i++)
497     lmm_expand(network_maxmin_system, route[i]->constraint,
498                action->variable, 1.0);
499   XBT_OUT;
500
501   return (surf_action_t) action;
502 }
503
504 /* returns an array of network_link_CM02_t */
505 static const void **get_route(void *src, void *dst)
506 {
507   network_card_CM02_t card_src = src;
508   network_card_CM02_t card_dst = dst;
509   return (const void **) ROUTE(card_src->id, card_dst->id);
510 }
511
512 static int get_route_size(void *src, void *dst)
513 {
514   network_card_CM02_t card_src = src;
515   network_card_CM02_t card_dst = dst;
516   return ROUTE_SIZE(card_src->id, card_dst->id);
517 }
518
519 static const char *get_link_name(const void *link)
520 {
521   return ((network_link_CM02_t) link)->name;
522 }
523
524 static double get_link_bandwidth(const void *link)
525 {
526   return ((network_link_CM02_t) link)->bw_current;
527 }
528
529 static double get_link_latency(const void *link)
530 {
531   return ((network_link_CM02_t) link)->lat_current;
532 }
533
534 static void action_suspend(surf_action_t action)
535 {
536   ((surf_action_network_CM02_t) action)->suspended = 1;
537   lmm_update_variable_weight(network_maxmin_system,
538                              ((surf_action_network_CM02_t) action)->
539                              variable, 0.0);
540 }
541
542 static void action_resume(surf_action_t action)
543 {
544   if (((surf_action_network_CM02_t) action)->suspended) {
545     lmm_update_variable_weight(network_maxmin_system,
546                                ((surf_action_network_CM02_t) action)->
547                                variable,
548                                ((surf_action_network_CM02_t) action)->
549                                lat_current);
550     ((surf_action_network_CM02_t) action)->suspended = 0;
551   }
552 }
553
554 static int action_is_suspended(surf_action_t action)
555 {
556   return ((surf_action_network_CM02_t) action)->suspended;
557 }
558
559 static void action_set_max_duration(surf_action_t action, double duration)
560 {
561   action->max_duration = duration;
562 }
563
564 static void finalize(void)
565 {
566   int i, j;
567
568   xbt_dict_free(&network_card_set);
569   xbt_dict_free(&network_link_set);
570   xbt_swag_free(surf_network_model->common_public->states.
571                 ready_action_set);
572   xbt_swag_free(surf_network_model->common_public->states.
573                 running_action_set);
574   xbt_swag_free(surf_network_model->common_public->states.
575                 failed_action_set);
576   xbt_swag_free(surf_network_model->common_public->states.
577                 done_action_set);
578   free(surf_network_model->common_public);
579   free(surf_network_model->common_private);
580   free(surf_network_model->extension_public);
581
582   free(surf_network_model);
583   surf_network_model = NULL;
584
585   loopback = NULL;
586   for (i = 0; i < card_number; i++)
587     for (j = 0; j < card_number; j++)
588       free(ROUTE(i, j));
589   free(routing_table);
590   routing_table = NULL;
591   free(routing_table_size);
592   routing_table_size = NULL;
593   card_number = 0;
594 }
595
596 static void surf_network_model_init_internal(void)
597 {
598   s_surf_action_t action;
599
600   surf_network_model = xbt_new0(s_surf_network_model_t, 1);
601
602   surf_network_model->common_private =
603       xbt_new0(s_surf_model_private_t, 1);
604   surf_network_model->common_public =
605       xbt_new0(s_surf_model_public_t, 1);
606   surf_network_model->extension_public =
607       xbt_new0(s_surf_network_model_extension_public_t, 1);
608
609   surf_network_model->common_public->states.ready_action_set =
610       xbt_swag_new(xbt_swag_offset(action, state_hookup));
611   surf_network_model->common_public->states.running_action_set =
612       xbt_swag_new(xbt_swag_offset(action, state_hookup));
613   surf_network_model->common_public->states.failed_action_set =
614       xbt_swag_new(xbt_swag_offset(action, state_hookup));
615   surf_network_model->common_public->states.done_action_set =
616       xbt_swag_new(xbt_swag_offset(action, state_hookup));
617
618   surf_network_model->common_public->name_service = name_service;
619   surf_network_model->common_public->get_resource_name =
620       get_resource_name;
621   surf_network_model->common_public->action_get_state =
622       surf_action_get_state;
623   surf_network_model->common_public->action_get_start_time =
624       surf_action_get_start_time;
625   surf_network_model->common_public->action_get_finish_time =
626       surf_action_get_finish_time;
627   surf_network_model->common_public->action_free = action_free;
628   surf_network_model->common_public->action_use = action_use;
629   surf_network_model->common_public->action_cancel = action_cancel;
630   surf_network_model->common_public->action_recycle = action_recycle;
631   surf_network_model->common_public->action_change_state =
632       action_change_state;
633   surf_network_model->common_public->action_set_data =
634       surf_action_set_data;
635   surf_network_model->common_public->name = "network";
636
637   surf_network_model->common_private->resource_used = resource_used;
638   surf_network_model->common_private->share_resources = share_resources;
639   surf_network_model->common_private->update_actions_state =
640       update_actions_state;
641   surf_network_model->common_private->update_resource_state =
642       update_resource_state;
643   surf_network_model->common_private->finalize = finalize;
644
645   surf_network_model->common_public->suspend = action_suspend;
646   surf_network_model->common_public->resume = action_resume;
647   surf_network_model->common_public->is_suspended = action_is_suspended;
648   surf_cpu_model->common_public->set_max_duration =
649       action_set_max_duration;
650
651   surf_network_model->extension_public->communicate = communicate;
652   surf_network_model->extension_public->get_route = get_route;
653   surf_network_model->extension_public->get_route_size = get_route_size;
654   surf_network_model->extension_public->get_link_name = get_link_name;
655   surf_network_model->extension_public->get_link_bandwidth =
656       get_link_bandwidth;
657   surf_network_model->extension_public->get_link_latency =
658       get_link_latency;
659
660   network_link_set = xbt_dict_new();
661   network_card_set = xbt_dict_new();
662
663   if (!network_maxmin_system)
664     network_maxmin_system = lmm_system_new();
665 }
666
667 /***************************************************************************/
668 /* The nice TCP sharing model designed by Loris Marchal and Henri Casanova */
669 /***************************************************************************/
670 /* @TechReport{      rr-lip2002-40, */
671 /*   author        = {Henri Casanova and Loris Marchal}, */
672 /*   institution   = {LIP}, */
673 /*   title         = {A Network Model for Simulation of Grid Application}, */
674 /*   number        = {2002-40}, */
675 /*   month         = {oct}, */
676 /*   year          = {2002} */
677 /* } */
678 void surf_network_model_init_CM02(const char *filename)
679 {
680
681   if (surf_network_model)
682     return;
683   surf_network_model_init_internal();
684   parse_file(filename);
685   xbt_dynar_push(model_list, &surf_network_model);
686   network_solve = lmm_solve;
687
688   update_model_description(surf_network_model_description,
689                               surf_network_model_description_size,
690                               "CM02",
691                               (surf_model_t) surf_network_model);
692 }
693
694 void surf_network_model_init_Reno(const char *filename)
695 {
696   if (surf_network_model)
697     return;
698   surf_network_model_init_internal();
699   parse_file(filename);
700
701   xbt_dynar_push(model_list, &surf_network_model);
702   lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
703                                     func_reno_fpi);
704   network_solve = lagrange_solve;
705
706   update_model_description(surf_network_model_description,
707                               surf_network_model_description_size,
708                               "Reno",
709                               (surf_model_t) surf_network_model);
710 }
711
712 void surf_network_model_init_Vegas(const char *filename)
713 {
714   if (surf_network_model)
715     return;
716   surf_network_model_init_internal();
717   parse_file(filename);
718
719   xbt_dynar_push(model_list, &surf_network_model);
720   lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
721                                     func_vegas_fpi);
722   network_solve = lagrange_solve;
723
724   update_model_description(surf_network_model_description,
725                               surf_network_model_description_size,
726                               "Vegas",
727                               (surf_model_t) surf_network_model);
728 }
729
730 #ifdef HAVE_SDP
731 void surf_network_model_init_SDP(const char *filename)
732 {
733   if (surf_network_model)
734     return;
735   surf_network_model_init_internal();
736   parse_file(filename);
737
738   xbt_dynar_push(model_list, &surf_network_model);
739   network_solve = sdp_solve;
740
741   update_model_description(surf_network_model_description,
742                               surf_network_model_description_size,
743                               "SDP",
744                               (surf_model_t) surf_network_model);
745 }
746 #endif