Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c17056573325c13b8a394e268bb7abfa15ac9842
[simgrid.git] / src / surf / cpu_im.c
1 /* Copyright (c) 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 "surf_private.h"
8
9 #undef GENERIC_LMM_ACTION
10 #undef GENERIC_ACTION
11 #undef ACTION_GET_CPU
12 #define GENERIC_LMM_ACTION(action) action->generic_lmm_action
13 #define GENERIC_ACTION(action) GENERIC_LMM_ACTION(action).generic_action
14 #define ACTION_GET_CPU(action) ((surf_action_cpu_Cas01_im_t) action)->cpu
15
16 typedef struct surf_action_cpu_cas01_im {
17   s_surf_action_lmm_t generic_lmm_action;
18   s_xbt_swag_hookup_t cpu_list_hookup;
19   int index_heap;
20   void *cpu;
21 } s_surf_action_cpu_Cas01_im_t, *surf_action_cpu_Cas01_im_t;
22
23 typedef struct cpu_Cas01_im {
24   s_surf_resource_t generic_resource;
25   s_xbt_swag_hookup_t modified_cpu_hookup;
26   double power_peak;
27   double power_scale;
28   tmgr_trace_event_t power_event;
29   e_surf_resource_state_t state_current;
30   tmgr_trace_event_t state_event;
31   lmm_constraint_t constraint;
32   xbt_swag_t action_set;
33   double last_update;
34 } s_cpu_Cas01_im_t, *cpu_Cas01_im_t;
35
36 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_im, surf,
37                                 "Logging specific to the SURF CPU IMPROVED module");
38
39
40 lmm_system_t cpu_im_maxmin_system = NULL;
41 static xbt_swag_t cpu_im_modified_cpu = NULL;
42 static xbt_heap_t cpu_im_action_heap = NULL;
43 extern int sg_maxmin_selective_update;
44
45
46 static xbt_swag_t cpu_im_running_action_set_that_does_not_need_being_checked = NULL;
47
48 static cpu_Cas01_im_t cpu_im_new(char *name, double power_peak,
49                               double power_scale,
50                               tmgr_trace_t power_trace,
51                               e_surf_resource_state_t state_initial,
52                               tmgr_trace_t state_trace,
53                               xbt_dict_t cpu_properties)
54 {
55   cpu_Cas01_im_t cpu = NULL;
56   s_surf_action_cpu_Cas01_im_t action;
57   cpu = xbt_new0(s_cpu_Cas01_im_t, 1);
58
59   #ifdef HAVE_TRACING
60   TRACE_surf_host_declaration (name, power_scale * power_peak);
61   #endif
62
63   xbt_assert1(!surf_model_resource_by_name(surf_cpu_model, name),
64               "Host '%s' declared several times in the platform file", name);
65   cpu->generic_resource.model = surf_cpu_model;
66   cpu->generic_resource.name = name;
67   cpu->generic_resource.properties = cpu_properties;
68   cpu->power_peak = power_peak;
69   xbt_assert0(cpu->power_peak > 0, "Power has to be >0");
70   cpu->power_scale = power_scale;
71   if (power_trace)
72     cpu->power_event =
73       tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
74
75   cpu->state_current = state_initial;
76   if (state_trace)
77     cpu->state_event =
78       tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
79
80   cpu->constraint =
81     lmm_constraint_new(cpu_im_maxmin_system, cpu,
82                        cpu->power_scale * cpu->power_peak);
83
84   xbt_dict_set(surf_model_resource_set(surf_cpu_model), name, cpu,
85                surf_resource_free);
86   cpu->action_set = xbt_swag_new(xbt_swag_offset(action, cpu_list_hookup));
87
88   return cpu;
89 }
90
91
92 static void parse_cpu_im_init(void)
93 {
94   double power_peak = 0.0;
95   double power_scale = 0.0;
96   tmgr_trace_t power_trace = NULL;
97   e_surf_resource_state_t state_initial = SURF_RESOURCE_OFF;
98   tmgr_trace_t state_trace = NULL;
99
100   power_peak = get_cpu_power(A_surfxml_host_power);
101   surf_parse_get_double(&power_scale, A_surfxml_host_availability);
102   power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
103
104   xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
105               (A_surfxml_host_state == A_surfxml_host_state_OFF),
106               "Invalid state");
107   if (A_surfxml_host_state == A_surfxml_host_state_ON)
108     state_initial = SURF_RESOURCE_ON;
109   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
110     state_initial = SURF_RESOURCE_OFF;
111   state_trace = tmgr_trace_new(A_surfxml_host_state_file);
112
113   current_property_set = xbt_dict_new();
114   cpu_im_new(xbt_strdup(A_surfxml_host_id), power_peak, power_scale,
115           power_trace, state_initial, state_trace, current_property_set);
116
117 }
118
119 static void cpu_im_add_traces_cpu(void)
120 {
121   xbt_dict_cursor_t cursor = NULL;
122   char *trace_name, *elm;
123
124   static int called = 0;
125
126   if (called)
127     return;
128   called = 1;
129
130
131   /* connect all traces relative to hosts */
132   xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
133     tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
134     cpu_Cas01_im_t host = surf_model_resource_by_name(surf_cpu_model, elm);
135
136     xbt_assert1(host, "Host %s undefined", elm);
137     xbt_assert1(trace, "Trace %s undefined", trace_name);
138
139     host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host);
140   }
141
142   xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
143     tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
144     cpu_Cas01_im_t host = surf_model_resource_by_name(surf_cpu_model, elm);
145
146     xbt_assert1(host, "Host %s undefined", elm);
147     xbt_assert1(trace, "Trace %s undefined", trace_name);
148
149     host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host);
150   }
151 }
152
153 static void cpu_im_define_callbacks(const char *file)
154 {
155   surf_parse_reset_parser();
156   surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_im_init);
157   surfxml_add_callback(ETag_surfxml_platform_cb_list, &cpu_im_add_traces_cpu);
158 }
159
160 static int cpu_im_resource_used(void *resource_id)
161 {
162   return lmm_constraint_used(cpu_im_maxmin_system,
163                              ((cpu_Cas01_im_t) resource_id)->constraint);
164 }
165
166 static int cpu_im_action_unref(surf_action_t action)
167 {
168   action->refcount--;
169   if (!action->refcount) {
170     xbt_swag_remove(action, action->state_set);
171     if (((surf_action_lmm_t) action)->variable)
172       lmm_variable_free(cpu_im_maxmin_system,
173                         ((surf_action_lmm_t) action)->variable);
174     /* remove from heap */
175     xbt_heap_remove(cpu_im_action_heap,
176                     ((surf_action_cpu_Cas01_im_t) action)->index_heap);
177     xbt_swag_remove(action,
178                     ((cpu_Cas01_im_t) ACTION_GET_CPU(action))->action_set);
179     xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
180     free(action);
181     return 1;
182   }
183   return 0;
184 }
185
186 static void cpu_im_action_cancel(surf_action_t action)
187 {
188   surf_action_state_set(action, SURF_ACTION_FAILED);
189   xbt_heap_remove(cpu_im_action_heap,
190                   ((surf_action_cpu_Cas01_im_t) action)->index_heap);
191   xbt_swag_remove(action,
192                   ((cpu_Cas01_im_t) ACTION_GET_CPU(action))->action_set);
193   return;
194 }
195
196 static void cpu_im_cpu_action_state_set(surf_action_t action,
197                                  e_surf_action_state_t state)
198 {
199 /*   if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
200 /*     if(((surf_action_lmm_t)action)->variable) { */
201 /*       lmm_variable_disable(cpu_im_maxmin_system, ((surf_action_lmm_t)action)->variable); */
202 /*       ((surf_action_lmm_t)action)->variable = NULL; */
203 /*     } */
204
205   surf_action_state_set(action, state);
206   return;
207 }
208
209 static void cpu_im_update_remains(cpu_Cas01_im_t cpu, double now)
210 {
211   surf_action_cpu_Cas01_im_t action;
212
213   if (cpu->last_update >= now)
214     return;
215   xbt_swag_foreach(action, cpu->action_set) {
216     if (GENERIC_ACTION(action).state_set !=
217         surf_cpu_model->states.running_action_set)
218       continue;
219
220     /* bogus priority, skip it */
221     if (GENERIC_ACTION(action).priority <= 0)
222       continue;
223
224     if (GENERIC_ACTION(action).remains > 0) {
225       double_update(&(GENERIC_ACTION(action).remains),
226                     lmm_variable_getvalue(GENERIC_LMM_ACTION
227                                           (action).variable) * (now -
228                                                                 cpu->last_update));
229 #ifdef HAVE_TRACING
230       TRACE_surf_host_set_utilization (cpu->generic_resource.name,
231                 action->generic_lmm_action.generic_action.data, lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable), cpu->last_update, now-cpu->last_update);
232 #endif
233       DEBUG2("Update action(%p) remains %lf", action,
234              GENERIC_ACTION(action).remains);
235     }
236   }
237   cpu->last_update = now;
238 }
239
240 static double cpu_im_share_resources(double now)
241 {
242   surf_action_cpu_Cas01_im_t action;
243   double min;
244   double value;
245   cpu_Cas01_im_t cpu, cpu_next;
246
247   xbt_swag_foreach(cpu, cpu_im_modified_cpu)
248     cpu_im_update_remains(cpu, now);
249
250   lmm_solve(cpu_im_maxmin_system);
251
252   xbt_swag_foreach_safe(cpu, cpu_next, cpu_im_modified_cpu) {
253     xbt_swag_foreach(action, cpu->action_set) {
254       if (GENERIC_ACTION(action).state_set !=
255           surf_cpu_model->states.running_action_set)
256         continue;
257
258       /* bogus priority, skip it */
259       if (GENERIC_ACTION(action).priority <= 0)
260         continue;
261
262       min = -1;
263       value = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable);
264       if (value > 0) {
265         if (GENERIC_ACTION(action).remains > 0)
266           value = GENERIC_ACTION(action).remains / value;
267         else
268           value = 0.0;
269       }
270       if (value > 0)
271         min = now + value;
272
273       if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION)
274           && (min == -1
275               || GENERIC_ACTION(action).start +
276               GENERIC_ACTION(action).max_duration < min))
277         min =
278           GENERIC_ACTION(action).start + GENERIC_ACTION(action).max_duration;
279
280       DEBUG4("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
281              GENERIC_ACTION(action).start, now + value,
282              GENERIC_ACTION(action).max_duration);
283
284       if (action->index_heap >= 0) {
285         surf_action_cpu_Cas01_im_t heap_act =
286           xbt_heap_remove(cpu_im_action_heap, action->index_heap);
287         if (heap_act != action)
288           DIE_IMPOSSIBLE;
289       }
290       if (min != -1) {
291         xbt_heap_push(cpu_im_action_heap, action, min);
292         DEBUG2("Insert at heap action(%p) min %lf", action, min);
293       }
294     }
295     xbt_swag_remove(cpu, cpu_im_modified_cpu);
296   }
297   return xbt_heap_size(cpu_im_action_heap) >
298     0 ? xbt_heap_maxkey(cpu_im_action_heap) - now : -1;
299 }
300
301 static void cpu_im_update_actions_state(double now, double delta)
302 {
303   surf_action_cpu_Cas01_im_t action;
304
305   while ((xbt_heap_size(cpu_im_action_heap) > 0)
306          && (double_equals(xbt_heap_maxkey(cpu_im_action_heap), now))) {
307     action = xbt_heap_pop(cpu_im_action_heap);
308     DEBUG1("Action %p: finish", action);
309     GENERIC_ACTION(action).finish = surf_get_clock();
310     /* set the remains to 0 due to precision problems when updating the remaining amount */
311 #ifdef HAVE_TRACING
312     TRACE_surf_host_set_utilization (((cpu_Cas01_im_t)(action->cpu))->generic_resource.name,
313               action->generic_lmm_action.generic_action.data, lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable), ((cpu_Cas01_im_t)(action->cpu))->last_update, now-((cpu_Cas01_im_t)(action->cpu))->last_update);
314 #endif
315     GENERIC_ACTION(action).remains = 0;
316     cpu_im_cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
317     cpu_im_update_remains(action->cpu, surf_get_clock());
318   }
319   return;
320 }
321
322 static void cpu_im_update_resource_state(void *id,
323                                   tmgr_trace_event_t event_type,
324                                   double value, double date)
325 {
326   cpu_Cas01_im_t cpu = id;
327
328   if (event_type == cpu->power_event) {
329     cpu->power_scale = value;
330     lmm_update_constraint_bound(cpu_im_maxmin_system, cpu->constraint,
331                                 cpu->power_scale * cpu->power_peak);
332 #ifdef HAVE_TRACING
333     TRACE_surf_host_set_power (date, cpu->generic_resource.name, cpu->power_scale * cpu->power_peak);
334 #endif
335     xbt_swag_insert(cpu, cpu_im_modified_cpu);
336     if (tmgr_trace_event_free(event_type))
337       cpu->power_event = NULL;
338   } else if (event_type == cpu->state_event) {
339     if (value > 0)
340       cpu->state_current = SURF_RESOURCE_ON;
341     else {
342       lmm_constraint_t cnst = cpu->constraint;
343       lmm_variable_t var = NULL;
344       lmm_element_t elem = NULL;
345
346       cpu->state_current = SURF_RESOURCE_OFF;
347
348       while ((var = lmm_get_var_from_cnst(cpu_im_maxmin_system, cnst, &elem))) {
349         surf_action_t action = lmm_variable_id(var);
350
351         if (surf_action_state_get(action) == SURF_ACTION_RUNNING ||
352             surf_action_state_get(action) == SURF_ACTION_READY ||
353             surf_action_state_get(action) == SURF_ACTION_NOT_IN_THE_SYSTEM) {
354           action->finish = date;
355           cpu_im_cpu_action_state_set(action, SURF_ACTION_FAILED);
356         }
357       }
358     }
359     if (tmgr_trace_event_free(event_type))
360       cpu->state_event = NULL;
361   } else {
362     CRITICAL0("Unknown event ! \n");
363     xbt_abort();
364   }
365
366   return;
367 }
368
369 static surf_action_t cpu_im_execute(void *cpu, double size)
370 {
371   surf_action_cpu_Cas01_im_t action = NULL;
372   cpu_Cas01_im_t CPU = cpu;
373
374   XBT_IN2("(%s,%g)", surf_resource_name(CPU), size);
375   action =
376     surf_action_new(sizeof(s_surf_action_cpu_Cas01_im_t), size,
377                     surf_cpu_model, CPU->state_current != SURF_RESOURCE_ON);
378
379   GENERIC_LMM_ACTION(action).suspended = 0;     /* Should be useless because of the
380                                                    calloc but it seems to help valgrind... */
381
382   GENERIC_LMM_ACTION(action).variable =
383     lmm_variable_new(cpu_im_maxmin_system, action,
384                      GENERIC_ACTION(action).priority, -1.0, 1);
385   action->index_heap = -1;
386   action->cpu = CPU;
387   xbt_swag_insert(CPU, cpu_im_modified_cpu);
388   xbt_swag_insert(action, CPU->action_set);
389   lmm_expand(cpu_im_maxmin_system, CPU->constraint,
390              GENERIC_LMM_ACTION(action).variable, 1.0);
391   XBT_OUT;
392   return (surf_action_t) action;
393 }
394
395 static surf_action_t cpu_im_action_sleep(void *cpu, double duration)
396 {
397   surf_action_cpu_Cas01_im_t action = NULL;
398
399   if (duration > 0)
400     duration = MAX(duration, MAXMIN_PRECISION);
401
402   XBT_IN2("(%s,%g)", surf_resource_name(cpu), duration);
403   action = (surf_action_cpu_Cas01_im_t) cpu_im_execute(cpu, 1.0);
404   GENERIC_ACTION(action).max_duration = duration;
405   GENERIC_LMM_ACTION(action).suspended = 2;
406   if (duration == NO_MAX_DURATION) {
407     /* Move to the *end* of the corresponding action set. This convention
408        is used to speed up update_resource_state  */
409     xbt_swag_remove(action, ((surf_action_t) action)->state_set);
410     ((surf_action_t) action)->state_set =
411       cpu_im_running_action_set_that_does_not_need_being_checked;
412     xbt_swag_insert(action, ((surf_action_t) action)->state_set);
413   }
414
415   lmm_update_variable_weight(cpu_im_maxmin_system,
416                              GENERIC_LMM_ACTION(action).variable, 0.0);
417   xbt_swag_insert(cpu, cpu_im_modified_cpu);
418   XBT_OUT;
419   return (surf_action_t) action;
420 }
421
422 static void cpu_im_action_suspend(surf_action_t action)
423 {
424   XBT_IN1("(%p)", action);
425   if (((surf_action_lmm_t) action)->suspended != 2) {
426     lmm_update_variable_weight(cpu_im_maxmin_system,
427                                ((surf_action_lmm_t) action)->variable, 0.0);
428     ((surf_action_lmm_t) action)->suspended = 1;
429     xbt_heap_remove(cpu_im_action_heap,
430                     ((surf_action_cpu_Cas01_im_t) action)->index_heap);
431     xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
432   }
433   XBT_OUT;
434 }
435
436 static void cpu_im_action_resume(surf_action_t action)
437 {
438   XBT_IN1("(%p)", action);
439   if (((surf_action_lmm_t) action)->suspended != 2) {
440     lmm_update_variable_weight(cpu_im_maxmin_system,
441                                ((surf_action_lmm_t) action)->variable,
442                                action->priority);
443     ((surf_action_lmm_t) action)->suspended = 0;
444     xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
445   }
446   XBT_OUT;
447 }
448
449 static int cpu_im_action_is_suspended(surf_action_t action)
450 {
451   return (((surf_action_lmm_t) action)->suspended == 1);
452 }
453
454 static void cpu_im_action_set_max_duration(surf_action_t action, double duration)
455 {
456   XBT_IN2("(%p,%g)", action, duration);
457
458   action->max_duration = duration;
459   /* insert cpu in modified_cpu set to notice the max duration change */
460   xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
461   XBT_OUT;
462 }
463
464 static void cpu_im_action_set_priority(surf_action_t action, double priority)
465 {
466   XBT_IN2("(%p,%g)", action, priority);
467   action->priority = priority;
468   lmm_update_variable_weight(cpu_im_maxmin_system,
469                              ((surf_action_lmm_t) action)->variable,
470                              priority);
471
472   xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
473   XBT_OUT;
474 }
475
476 static double cpu_im_action_get_remains(surf_action_t action)
477 {
478   XBT_IN1("(%p)", action);
479   /* update remains before return it */
480   cpu_im_update_remains(ACTION_GET_CPU(action), surf_get_clock());
481   return action->remains;
482   XBT_OUT;
483 }
484
485 static e_surf_resource_state_t cpu_im_get_state(void *cpu)
486 {
487   return ((cpu_Cas01_im_t) cpu)->state_current;
488 }
489
490 static double cpu_im_get_speed(void *cpu, double load)
491 {
492   return load * (((cpu_Cas01_im_t) cpu)->power_peak);
493 }
494
495 static double cpu_im_get_available_speed(void *cpu)
496 {
497   /* number between 0 and 1 */
498   return ((cpu_Cas01_im_t) cpu)->power_scale;
499 }
500
501 static void cpu_im_action_update_index_heap(void *action, int i)
502 {
503   ((surf_action_cpu_Cas01_im_t) action)->index_heap = i;
504 }
505
506 static void cpu_im_finalize(void)
507 {
508   void *cpu;
509   xbt_dict_cursor_t cursor;
510   char *key;
511   xbt_dict_foreach(surf_model_resource_set(surf_cpu_model), cursor, key, cpu) {
512     cpu_Cas01_im_t CPU = cpu;
513     xbt_swag_free(CPU->action_set);
514   }
515
516   lmm_system_free(cpu_im_maxmin_system);
517   cpu_im_maxmin_system = NULL;
518
519   surf_model_exit(surf_cpu_model);
520   surf_cpu_model = NULL;
521
522   xbt_swag_free(cpu_im_running_action_set_that_does_not_need_being_checked);
523   cpu_im_running_action_set_that_does_not_need_being_checked = NULL;
524   xbt_heap_free(cpu_im_action_heap);
525   xbt_swag_free(cpu_im_modified_cpu);
526 }
527
528 static void surf_cpu_im_model_init_internal(void)
529 {
530   s_surf_action_t action;
531   s_cpu_Cas01_im_t cpu;
532
533   surf_cpu_model = surf_model_init();
534
535   cpu_im_running_action_set_that_does_not_need_being_checked =
536     xbt_swag_new(xbt_swag_offset(action, state_hookup));
537
538   surf_cpu_model->name = "CPU_IM";
539
540   surf_cpu_model->action_unref = cpu_im_action_unref;
541   surf_cpu_model->action_cancel = cpu_im_action_cancel;
542   surf_cpu_model->action_state_set = cpu_im_cpu_action_state_set;
543
544   surf_cpu_model->model_private->resource_used = cpu_im_resource_used;
545   surf_cpu_model->model_private->share_resources = cpu_im_share_resources;
546   surf_cpu_model->model_private->update_actions_state = cpu_im_update_actions_state;
547   surf_cpu_model->model_private->update_resource_state =
548     cpu_im_update_resource_state;
549   surf_cpu_model->model_private->finalize = cpu_im_finalize;
550
551   surf_cpu_model->suspend = cpu_im_action_suspend;
552   surf_cpu_model->resume = cpu_im_action_resume;
553   surf_cpu_model->is_suspended = cpu_im_action_is_suspended;
554   surf_cpu_model->set_max_duration = cpu_im_action_set_max_duration;
555   surf_cpu_model->set_priority = cpu_im_action_set_priority;
556   surf_cpu_model->get_remains = cpu_im_action_get_remains;
557
558   surf_cpu_model->extension.cpu.execute = cpu_im_execute;
559   surf_cpu_model->extension.cpu.sleep = cpu_im_action_sleep;
560
561   surf_cpu_model->extension.cpu.get_state = cpu_im_get_state;
562   surf_cpu_model->extension.cpu.get_speed = cpu_im_get_speed;
563   surf_cpu_model->extension.cpu.get_available_speed = cpu_im_get_available_speed;
564
565   if (!cpu_im_maxmin_system) {
566     sg_maxmin_selective_update = 1;
567     cpu_im_maxmin_system = lmm_system_new();
568   }
569   cpu_im_action_heap = xbt_heap_new(8, NULL);
570   xbt_heap_set_update_callback(cpu_im_action_heap, cpu_im_action_update_index_heap);
571   cpu_im_modified_cpu = xbt_swag_new(xbt_swag_offset(cpu, modified_cpu_hookup));
572 }
573
574 /*********************************************************************/
575 /* Basic sharing model for CPU: that is where all this started... ;) */
576 /*********************************************************************/
577 /* @InProceedings{casanova01simgrid, */
578 /*   author =       "H. Casanova", */
579 /*   booktitle =    "Proceedings of the IEEE Symposium on Cluster Computing */
580 /*                  and the Grid (CCGrid'01)", */
581 /*   publisher =    "IEEE Computer Society", */
582 /*   title =        "Simgrid: {A} Toolkit for the Simulation of Application */
583 /*                  Scheduling", */
584 /*   year =         "2001", */
585 /*   month =        may, */
586 /*   note =         "Available at */
587 /*                  \url{http://grail.sdsc.edu/papers/simgrid_ccgrid01.ps.gz}." */
588 /* } */
589 void surf_cpu_model_init_Cas01_im(const char *filename)
590 {
591   if (surf_cpu_model)
592     return;
593   surf_cpu_im_model_init_internal();
594   cpu_im_define_callbacks(filename);
595   xbt_dynar_push(model_list, &surf_cpu_model);
596 }