Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / surf / cpu_cas01.c
1 /* Copyright (c) 2009-2011. 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 #include "surf/surf_resource.h"
9 #include "maxmin_private.h"
10 #include "simgrid/sg_config.h"
11 #include "cpu_cas01_private.h"
12
13 #include "string.h"
14 #include "stdlib.h"
15
16 surf_model_t surf_cpu_model = NULL;
17
18
19 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
20                                 "Logging specific to the SURF CPU IMPROVED module");
21
22 static xbt_swag_t
23     cpu_running_action_set_that_does_not_need_being_checked = NULL;
24
25
26 /* This function is registered as a callback to sg_platf_new_host() and never called directly */
27 static void *cpu_create_resource(const char *name, xbt_dynar_t power_peak,
28                                                                  int pstate,
29                                  double power_scale,
30                                  tmgr_trace_t power_trace,
31                                  int core,
32                                  e_surf_resource_state_t state_initial,
33                                  tmgr_trace_t state_trace,
34                                  xbt_dict_t cpu_properties)
35 {
36   cpu_Cas01_t cpu = NULL;
37
38   xbt_assert(!surf_cpu_resource_priv(surf_cpu_resource_by_name(name)),
39              "Host '%s' declared several times in the platform file",
40              name);
41   cpu = (cpu_Cas01_t) surf_resource_new(sizeof(s_cpu_Cas01_t),
42                                         surf_cpu_model, name,
43                                         cpu_properties);
44   cpu->power_peak = xbt_dynar_get_as(power_peak, pstate, double);
45   cpu->power_peak_list = power_peak;
46   cpu->pstate = pstate;
47
48   cpu->energy = xbt_new(s_energy_cpu_cas01_t, 1);
49   cpu->energy->total_energy = 0;
50   cpu->energy->power_range_watts_list = cpu_get_watts_range_list(cpu);
51   cpu->energy->last_updated = surf_get_clock();
52
53   XBT_DEBUG("CPU create: peak=%lf, pstate=%d",cpu->power_peak, cpu->pstate);
54
55   xbt_assert(cpu->power_peak > 0, "Power has to be >0");
56   cpu->power_scale = power_scale;
57   cpu->core = core;
58   xbt_assert(core > 0, "Invalid number of cores %d", core);
59
60   if (power_trace)
61     cpu->power_event =
62         tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
63
64   cpu->state_current = state_initial;
65   if (state_trace)
66     cpu->state_event =
67         tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
68
69   cpu->constraint =
70       lmm_constraint_new(surf_cpu_model->model_private->maxmin_system, cpu,
71                          cpu->core * cpu->power_scale * cpu->power_peak);
72
73   xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
74
75   return xbt_lib_get_elm_or_null(host_lib, name);;
76 }
77
78
79 static void parse_cpu_init(sg_platf_host_cbarg_t host)
80 {
81   cpu_create_resource(host->id,
82                       host->power_peak,
83                       host->pstate,
84                       host->power_scale,
85                       host->power_trace,
86                       host->core_amount,
87                       host->initial_state,
88                       host->state_trace, host->properties);
89 }
90
91 static void cpu_add_traces_cpu(void)
92 {
93   xbt_dict_cursor_t cursor = NULL;
94   char *trace_name, *elm;
95   static int called = 0;
96   if (called)
97     return;
98   called = 1;
99
100   /* connect all traces relative to hosts */
101   xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
102     tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
103     cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
104
105     xbt_assert(host, "Host %s undefined", elm);
106     xbt_assert(trace, "Trace %s undefined", trace_name);
107
108     host->state_event =
109         tmgr_history_add_trace(history, trace, 0.0, 0, host);
110   }
111
112   xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
113     tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
114     cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
115
116     xbt_assert(host, "Host %s undefined", elm);
117     xbt_assert(trace, "Trace %s undefined", trace_name);
118
119     host->power_event =
120         tmgr_history_add_trace(history, trace, 0.0, 0, host);
121   }
122 }
123
124 static void cpu_define_callbacks()
125 {
126   sg_platf_host_add_cb(parse_cpu_init);
127   sg_platf_postparse_add_cb(cpu_add_traces_cpu);
128 }
129
130 static int cpu_resource_used(void *resource)
131 {
132   return lmm_constraint_used(surf_cpu_model->model_private->maxmin_system,
133                              ((cpu_Cas01_t) resource)->constraint);
134 }
135
136 static double cpu_share_resources_lazy(double now)
137 {
138   return generic_share_resources_lazy(now, surf_cpu_model);
139 }
140
141 static double cpu_share_resources_full(double now)
142 {
143   s_surf_action_cpu_Cas01_t action;
144   return generic_maxmin_share_resources(surf_cpu_model->states.
145                                         running_action_set,
146                                         xbt_swag_offset(action,
147                                                         generic_lmm_action.
148                                                         variable),
149                                         surf_cpu_model->model_private->maxmin_system, lmm_solve);
150 }
151
152 static void cpu_update_actions_state_lazy(double now, double delta)
153 {
154   generic_update_actions_state_lazy(now, delta, surf_cpu_model);
155 }
156
157 static void cpu_update_actions_state_full(double now, double delta)
158 {
159   generic_update_actions_state_full(now, delta, surf_cpu_model);
160 }
161
162 xbt_dynar_t cpu_get_watts_range_list(cpu_Cas01_t cpu_model)
163 {
164         xbt_dynar_t power_range_list = xbt_dynar_new(sizeof(xbt_dynar_t), NULL);
165         xbt_dynar_t power_tuple;
166         int i = 0, pstate_nb=0;
167         xbt_dynar_t current_power_values;
168         double min_power, max_power;
169         xbt_dict_t props = cpu_model->generic_resource.properties;
170
171         if (props == NULL)
172                 return NULL;
173
174         char* all_power_values_str = xbt_dict_get_or_null(props, "power_per_state");
175
176         if (all_power_values_str == NULL)
177                 return NULL;
178
179         xbt_dynar_t all_power_values = xbt_str_split(all_power_values_str, ",");
180
181         pstate_nb = xbt_dynar_length(all_power_values);
182         for (i=0; i< pstate_nb; i++)
183         {
184                 /* retrieve the power values associated with the current pstate */
185                 current_power_values = xbt_str_split(xbt_dynar_get_as(all_power_values, i, char*), ":");
186                 xbt_assert(xbt_dynar_length(current_power_values) > 1,
187                                 "Power properties incorrectly defined - could not retrieve min and max power values for host %s",
188                                 cpu_model->generic_resource.name);
189
190                 /* min_power corresponds to the idle power (cpu load = 0) */
191                 /* max_power is the power consumed at 100% cpu load       */
192                 min_power = atof(xbt_dynar_get_as(current_power_values, 0, char*));
193                 max_power = atof(xbt_dynar_get_as(current_power_values, 1, char*));
194
195                 power_tuple = xbt_dynar_new(sizeof(double), NULL);
196                 xbt_dynar_push_as(power_tuple, double, min_power);
197                 xbt_dynar_push_as(power_tuple, double, max_power);
198
199                 xbt_dynar_push_as(power_range_list, xbt_dynar_t, power_tuple);
200         }
201
202         return power_range_list;
203
204 }
205
206 /**
207  * Computes the power consumed by the host according to the current pstate and processor load
208  *
209  */
210 static double cpu_get_current_watts_value(cpu_Cas01_t cpu_model, double cpu_load)
211 {
212         xbt_dynar_t power_range_list = cpu_model->energy->power_range_watts_list;
213
214         if (power_range_list == NULL)
215         {
216                 XBT_DEBUG("No power range properties specified for host %s", cpu_model->generic_resource.name);
217                 return 0;
218         }
219         xbt_assert(xbt_dynar_length(power_range_list) == xbt_dynar_length(cpu_model->power_peak_list),
220                                                 "The number of power ranges in the properties does not match the number of pstates for host %s",
221                                                 cpu_model->generic_resource.name);
222
223     /* retrieve the power values associated with the current pstate */
224     xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, cpu_model->pstate, xbt_dynar_t);
225
226     /* min_power corresponds to the idle power (cpu load = 0) */
227     /* max_power is the power consumed at 100% cpu load       */
228     double min_power = xbt_dynar_get_as(current_power_values, 0, double);
229     double max_power = xbt_dynar_get_as(current_power_values, 1, double);
230     double power_slope = max_power - min_power;
231
232     double current_power = min_power + cpu_load * power_slope;
233
234         XBT_DEBUG("[get_current_watts] min_power=%lf, max_power=%lf, slope=%lf", min_power, max_power, power_slope);
235     XBT_DEBUG("[get_current_watts] Current power (watts) = %lf, load = %lf", current_power, cpu_load);
236
237         return current_power;
238
239 }
240
241 /**
242  * Updates the total energy consumed as the sum of the current energy and
243  *                                               the energy consumed by the current action
244  */
245 void cpu_update_energy(cpu_Cas01_t cpu_model, double cpu_load)
246 {
247
248   double start_time = cpu_model->energy->last_updated;
249   double finish_time = surf_get_clock();
250
251   XBT_DEBUG("[cpu_update_energy] action time interval=(%lf-%lf), current power peak=%lf, current pstate=%d",
252                   start_time, finish_time, cpu_model->power_peak, cpu_model->pstate);
253   double current_energy = cpu_model->energy->total_energy;
254   double action_energy = cpu_get_current_watts_value(cpu_model, cpu_load)*(finish_time-start_time);
255
256   cpu_model->energy->total_energy = current_energy + action_energy;
257   cpu_model->energy->last_updated = finish_time;
258
259   XBT_DEBUG("[cpu_update_energy] old_energy_value=%lf, action_energy_value=%lf", current_energy, action_energy);
260
261 }
262
263 static void cpu_update_resource_state(void *id,
264                                       tmgr_trace_event_t event_type,
265                                       double value, double date)
266 {
267   cpu_Cas01_t cpu = id;
268   lmm_variable_t var = NULL;
269   lmm_element_t elem = NULL;
270
271   if (event_type == cpu->power_event) {
272     cpu->power_scale = value;
273     lmm_update_constraint_bound(surf_cpu_model->model_private->maxmin_system, cpu->constraint,
274                                 cpu->core * cpu->power_scale *
275                                 cpu->power_peak);
276 #ifdef HAVE_TRACING
277     TRACE_surf_host_set_power(date, cpu->generic_resource.name,
278                               cpu->core * cpu->power_scale *
279                               cpu->power_peak);
280 #endif
281     while ((var = lmm_get_var_from_cnst
282             (surf_cpu_model->model_private->maxmin_system, cpu->constraint, &elem))) {
283       surf_action_cpu_Cas01_t action = lmm_variable_id(var);
284       lmm_update_variable_bound(surf_cpu_model->model_private->maxmin_system,
285                                 GENERIC_LMM_ACTION(action).variable,
286                                 cpu->power_scale * cpu->power_peak);
287     }
288     if (tmgr_trace_event_free(event_type))
289       cpu->power_event = NULL;
290   } else if (event_type == cpu->state_event) {
291     if (value > 0) {
292       if(cpu->state_current == SURF_RESOURCE_OFF)
293         xbt_dynar_push_as(host_that_restart, char*, (cpu->generic_resource.name));
294       cpu->state_current = SURF_RESOURCE_ON;
295     } else {
296       lmm_constraint_t cnst = cpu->constraint;
297
298       cpu->state_current = SURF_RESOURCE_OFF;
299
300       while ((var = lmm_get_var_from_cnst(surf_cpu_model->model_private->maxmin_system, cnst, &elem))) {
301         surf_action_t action = lmm_variable_id(var);
302
303         if (surf_action_state_get(action) == SURF_ACTION_RUNNING ||
304             surf_action_state_get(action) == SURF_ACTION_READY ||
305             surf_action_state_get(action) ==
306             SURF_ACTION_NOT_IN_THE_SYSTEM) {
307           action->finish = date;
308           surf_action_state_set(action, SURF_ACTION_FAILED);
309         }
310       }
311     }
312     if (tmgr_trace_event_free(event_type))
313       cpu->state_event = NULL;
314   } else {
315     XBT_CRITICAL("Unknown event ! \n");
316     xbt_abort();
317   }
318
319   return;
320 }
321
322 static surf_action_t cpu_execute(void *cpu, double size)
323 {
324   surf_action_cpu_Cas01_t action = NULL;
325   //xbt_dict_cursor_t cursor = NULL;
326   cpu_Cas01_t CPU = surf_cpu_resource_priv(cpu);
327   //xbt_dict_t props = CPU->generic_resource.properties;
328
329   XBT_IN("(%s,%g)", surf_resource_name(CPU), size);
330   action =
331       surf_action_new(sizeof(s_surf_action_cpu_Cas01_t), size,
332                       surf_cpu_model,
333                       CPU->state_current != SURF_RESOURCE_ON);
334
335   GENERIC_LMM_ACTION(action).suspended = 0;     /* Should be useless because of the
336                                                    calloc but it seems to help valgrind... */
337
338   GENERIC_LMM_ACTION(action).variable =
339       lmm_variable_new(surf_cpu_model->model_private->maxmin_system, action,
340                        GENERIC_ACTION(action).priority,
341                        CPU->power_scale * CPU->power_peak, 1);
342   if (surf_cpu_model->model_private->update_mechanism == UM_LAZY) {
343     GENERIC_LMM_ACTION(action).index_heap = -1;
344     GENERIC_LMM_ACTION(action).last_update = surf_get_clock();
345     GENERIC_LMM_ACTION(action).last_value = 0.0;
346   }
347
348   lmm_expand(surf_cpu_model->model_private->maxmin_system, CPU->constraint,
349              GENERIC_LMM_ACTION(action).variable, 1.0);
350   XBT_OUT();
351   return (surf_action_t) action;
352 }
353
354 static surf_action_t cpu_action_sleep(void *cpu, double duration)
355 {
356   surf_action_cpu_Cas01_t action = NULL;
357
358   if (duration > 0)
359     duration = MAX(duration, MAXMIN_PRECISION);
360
361   XBT_IN("(%s,%g)", surf_resource_name(surf_cpu_resource_priv(cpu)), duration);
362   action = (surf_action_cpu_Cas01_t) cpu_execute(cpu, 1.0);
363   // FIXME: sleep variables should not consume 1.0 in lmm_expand
364   GENERIC_ACTION(action).max_duration = duration;
365   GENERIC_LMM_ACTION(action).suspended = 2;
366   if (duration == NO_MAX_DURATION) {
367     /* Move to the *end* of the corresponding action set. This convention
368        is used to speed up update_resource_state  */
369     xbt_swag_remove(action, ((surf_action_t) action)->state_set);
370     ((surf_action_t) action)->state_set =
371         cpu_running_action_set_that_does_not_need_being_checked;
372     xbt_swag_insert(action, ((surf_action_t) action)->state_set);
373   }
374
375   lmm_update_variable_weight(surf_cpu_model->model_private->maxmin_system,
376                              GENERIC_LMM_ACTION(action).variable, 0.0);
377   if (surf_cpu_model->model_private->update_mechanism == UM_LAZY) {     // remove action from the heap
378     surf_action_lmm_heap_remove(surf_cpu_model->model_private->action_heap,(surf_action_lmm_t)action);
379     // this is necessary for a variable with weight 0 since such
380     // variables are ignored in lmm and we need to set its max_duration
381     // correctly at the next call to share_resources
382     xbt_swag_insert_at_head(action,surf_cpu_model->model_private->modified_set);
383   }
384
385   XBT_OUT();
386   return (surf_action_t) action;
387 }
388
389 static e_surf_resource_state_t cpu_get_state(void *cpu)
390 {
391   return ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->state_current;
392 }
393
394 static double cpu_get_speed(void *cpu, double load)
395 {
396   return load * ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->power_peak;
397 }
398
399 static int cpu_get_core(void *cpu)
400 {
401   return ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->core;
402 }
403
404
405 static double cpu_get_available_speed(void *cpu)
406 {
407   /* number between 0 and 1 */
408   return ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->power_scale;
409 }
410
411 static double cpu_get_current_power_peak(void *cpu)
412 {
413   return ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->power_peak;
414 }
415
416 static double cpu_get_power_peak_at(void *cpu, int pstate_index)
417 {
418   xbt_dynar_t plist = ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->power_peak_list;
419   xbt_assert((pstate_index <= xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
420
421   return xbt_dynar_get_as(plist, pstate_index, double);
422 }
423
424 static int cpu_get_nb_pstates(void *cpu)
425 {
426   return xbt_dynar_length(((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->power_peak_list);
427 }
428
429 static void cpu_set_power_peak_at(void *cpu, int pstate_index)
430 {
431   cpu_Cas01_t cpu_implem = (cpu_Cas01_t)surf_cpu_resource_priv(cpu);
432   xbt_dynar_t plist = cpu_implem->power_peak_list;
433   xbt_assert((pstate_index <= xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
434
435   double new_power_peak = xbt_dynar_get_as(plist, pstate_index, double);
436   cpu_implem->pstate = pstate_index;
437   cpu_implem->power_peak = new_power_peak;
438 }
439
440 static double cpu_get_consumed_energy(void *cpu)
441 {
442   return ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->energy->total_energy;
443 }
444
445 static void cpu_finalize(void)
446 {
447   lmm_system_free(surf_cpu_model->model_private->maxmin_system);
448   surf_cpu_model->model_private->maxmin_system = NULL;
449
450   if (surf_cpu_model->model_private->action_heap)
451     xbt_heap_free(surf_cpu_model->model_private->action_heap);
452   xbt_swag_free(surf_cpu_model->model_private->modified_set);
453
454   surf_model_exit(surf_cpu_model);
455   surf_cpu_model = NULL;
456
457   xbt_swag_free(cpu_running_action_set_that_does_not_need_being_checked);
458   cpu_running_action_set_that_does_not_need_being_checked = NULL;
459 }
460
461 static void surf_cpu_model_init_internal()
462 {
463   s_surf_action_t action;
464   s_surf_action_cpu_Cas01_t comp;
465
466   char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim");
467   int select =
468       xbt_cfg_get_boolean(_sg_cfg_set, "cpu/maxmin_selective_update");
469
470   surf_cpu_model = surf_model_init();
471
472   if (!strcmp(optim, "Full")) {
473     surf_cpu_model->model_private->update_mechanism = UM_FULL;
474     surf_cpu_model->model_private->selective_update = select;
475   } else if (!strcmp(optim, "Lazy")) {
476     surf_cpu_model->model_private->update_mechanism = UM_LAZY;
477     surf_cpu_model->model_private->selective_update = 1;
478     xbt_assert((select == 1)
479                ||
480                (xbt_cfg_is_default_value
481                 (_sg_cfg_set, "cpu/maxmin_selective_update")),
482                "Disabling selective update while using the lazy update mechanism is dumb!");
483   } else {
484     xbt_die("Unsupported optimization (%s) for this model", optim);
485   }
486
487   cpu_running_action_set_that_does_not_need_being_checked =
488       xbt_swag_new(xbt_swag_offset(action, state_hookup));
489
490   surf_cpu_model->name = "cpu";
491
492   surf_cpu_model->action_unref = surf_action_unref;
493   surf_cpu_model->action_cancel = surf_action_cancel;
494   surf_cpu_model->action_state_set = surf_action_state_set;
495
496   surf_cpu_model->model_private->resource_used = cpu_resource_used;
497
498   if (surf_cpu_model->model_private->update_mechanism == UM_LAZY) {
499     surf_cpu_model->model_private->share_resources =
500         cpu_share_resources_lazy;
501     surf_cpu_model->model_private->update_actions_state =
502         cpu_update_actions_state_lazy;
503   } else if (surf_cpu_model->model_private->update_mechanism == UM_FULL) {
504     surf_cpu_model->model_private->share_resources =
505         cpu_share_resources_full;
506     surf_cpu_model->model_private->update_actions_state =
507         cpu_update_actions_state_full;
508   } else
509     xbt_die("Invalid cpu update mechanism!");
510
511   surf_cpu_model->model_private->update_resource_state =
512       cpu_update_resource_state;
513   surf_cpu_model->model_private->finalize = cpu_finalize;
514
515   surf_cpu_model->suspend = surf_action_suspend;
516   surf_cpu_model->resume = surf_action_resume;
517   surf_cpu_model->is_suspended = surf_action_is_suspended;
518   surf_cpu_model->set_max_duration = surf_action_set_max_duration;
519   surf_cpu_model->set_priority = surf_action_set_priority;
520 #ifdef HAVE_TRACING
521   surf_cpu_model->set_category = surf_action_set_category;
522 #endif
523   surf_cpu_model->get_remains = surf_action_get_remains;
524
525   surf_cpu_model->extension.cpu.execute = cpu_execute;
526   surf_cpu_model->extension.cpu.sleep = cpu_action_sleep;
527
528   surf_cpu_model->extension.cpu.get_state = cpu_get_state;
529   surf_cpu_model->extension.cpu.get_core = cpu_get_core;
530   surf_cpu_model->extension.cpu.get_speed = cpu_get_speed;
531   surf_cpu_model->extension.cpu.get_available_speed =
532       cpu_get_available_speed;
533   surf_cpu_model->extension.cpu.get_current_power_peak = cpu_get_current_power_peak;
534   surf_cpu_model->extension.cpu.get_power_peak_at = cpu_get_power_peak_at;
535   surf_cpu_model->extension.cpu.get_nb_pstates = cpu_get_nb_pstates;
536   surf_cpu_model->extension.cpu.set_power_peak_at = cpu_set_power_peak_at;
537   surf_cpu_model->extension.cpu.get_consumed_energy = cpu_get_consumed_energy;
538
539   surf_cpu_model->extension.cpu.add_traces = cpu_add_traces_cpu;
540
541   if (!surf_cpu_model->model_private->maxmin_system) {
542     surf_cpu_model->model_private->maxmin_system = lmm_system_new(surf_cpu_model->model_private->selective_update);
543   }
544   if (surf_cpu_model->model_private->update_mechanism == UM_LAZY) {
545     surf_cpu_model->model_private->action_heap = xbt_heap_new(8, NULL);
546     xbt_heap_set_update_callback(surf_cpu_model->model_private->action_heap,
547         surf_action_lmm_update_index_heap);
548     surf_cpu_model->model_private->modified_set =
549         xbt_swag_new(xbt_swag_offset(comp, generic_lmm_action.action_list_hookup));
550     surf_cpu_model->model_private->maxmin_system->keep_track = surf_cpu_model->model_private->modified_set;
551   }
552 }
553
554 /*********************************************************************/
555 /* Basic sharing model for CPU: that is where all this started... ;) */
556 /*********************************************************************/
557 /* @InProceedings{casanova01simgrid, */
558 /*   author =       "H. Casanova", */
559 /*   booktitle =    "Proceedings of the IEEE Symposium on Cluster Computing */
560 /*                  and the Grid (CCGrid'01)", */
561 /*   publisher =    "IEEE Computer Society", */
562 /*   title =        "Simgrid: {A} Toolkit for the Simulation of Application */
563 /*                  Scheduling", */
564 /*   year =         "2001", */
565 /*   month =        may, */
566 /*   note =         "Available at */
567 /*                  \url{http://grail.sdsc.edu/papers/simgrid_ccgrid01.ps.gz}." */
568 /* } */
569
570 void surf_cpu_model_init_Cas01()
571 {
572   char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim");
573
574   if (surf_cpu_model)
575     return;
576
577   if (!strcmp(optim, "TI")) {
578     surf_cpu_model_init_ti();
579     return;
580   }
581
582   surf_cpu_model_init_internal();
583   cpu_define_callbacks();
584   xbt_dynar_push(model_list, &surf_cpu_model);
585 }