Logo AND Algorithmique Numérique Distribuée

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