1 /* Copyright (c) 2009-2011. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #include "surf_private.h"
8 #include "surf/surf_resource.h"
9 #include "maxmin_private.h"
11 surf_model_t surf_cpu_model = NULL;
12 lmm_system_t cpu_maxmin_system = NULL;
13 e_UM_t cpu_update_mechanism = UM_UNDEFINED;
14 static int cpu_selective_update = 0;
16 static xbt_swag_t cpu_modified_set= NULL;
17 static xbt_heap_t cpu_action_heap = NULL;
19 #undef GENERIC_LMM_ACTION
22 #define GENERIC_LMM_ACTION(action) action->generic_lmm_action
23 #define GENERIC_ACTION(action) GENERIC_LMM_ACTION(action).generic_action
24 #define ACTION_GET_CPU(action) ((surf_action_cpu_Cas01_t) action)->cpu
26 typedef struct surf_action_cpu_cas01 {
27 s_surf_action_lmm_t generic_lmm_action;
28 } s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
30 typedef struct cpu_Cas01 {
31 s_surf_resource_t generic_resource;
32 s_xbt_swag_hookup_t modified_cpu_hookup;
35 tmgr_trace_event_t power_event;
37 e_surf_resource_state_t state_current;
38 tmgr_trace_event_t state_event;
39 lmm_constraint_t constraint;
40 } s_cpu_Cas01_t, *cpu_Cas01_t;
42 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
43 "Logging specific to the SURF CPU IMPROVED module");
48 cpu_running_action_set_that_does_not_need_being_checked = NULL;
51 static void *cpu_create_resource(const char *name, double power_peak,
53 tmgr_trace_t power_trace,
55 e_surf_resource_state_t state_initial,
56 tmgr_trace_t state_trace,
57 xbt_dict_t cpu_properties)
59 cpu_Cas01_t cpu = NULL;
61 xbt_assert(!surf_cpu_resource_by_name(name),
62 "Host '%s' declared several times in the platform file",
64 cpu = (cpu_Cas01_t) surf_resource_new(sizeof(s_cpu_Cas01_t),
67 cpu->power_peak = power_peak;
68 xbt_assert(cpu->power_peak > 0, "Power has to be >0");
69 cpu->power_scale = power_scale;
71 xbt_assert(core > 0, "Invalid number of cores %d", core);
75 tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
77 cpu->state_current = state_initial;
80 tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
83 lmm_constraint_new(cpu_maxmin_system, cpu,
84 cpu->core * cpu->power_scale * cpu->power_peak);
86 xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
92 static void parse_cpu_init(sg_platf_host_cbarg_t host)
94 cpu_create_resource(host->id,
100 host->state_trace, host->properties);
103 static void cpu_add_traces_cpu(void)
105 xbt_dict_cursor_t cursor = NULL;
106 char *trace_name, *elm;
107 static int called = 0;
112 /* connect all traces relative to hosts */
113 xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
114 tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
115 cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
117 xbt_assert(host, "Host %s undefined", elm);
118 xbt_assert(trace, "Trace %s undefined", trace_name);
121 tmgr_history_add_trace(history, trace, 0.0, 0, host);
124 xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
125 tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
126 cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
128 xbt_assert(host, "Host %s undefined", elm);
129 xbt_assert(trace, "Trace %s undefined", trace_name);
132 tmgr_history_add_trace(history, trace, 0.0, 0, host);
136 static void cpu_define_callbacks()
138 sg_platf_host_add_cb(parse_cpu_init);
139 sg_platf_postparse_add_cb(cpu_add_traces_cpu);
142 static int cpu_resource_used(void *resource)
144 return lmm_constraint_used(cpu_maxmin_system,
145 ((cpu_Cas01_t) resource)->constraint);
148 static int cpu_action_unref(surf_action_t action)
151 if (!action->refcount) {
152 xbt_swag_remove(action, action->state_set);
153 if (((surf_action_lmm_t) action)->variable)
154 lmm_variable_free(cpu_maxmin_system,
155 ((surf_action_lmm_t) action)->variable);
156 if (cpu_update_mechanism == UM_LAZY) {
157 /* remove from heap */
158 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action);
159 xbt_swag_remove(action, cpu_modified_set);
162 xbt_free(action->category);
164 surf_action_free(&action);
170 static void cpu_action_cancel(surf_action_t action)
172 surf_action_state_set(action, SURF_ACTION_FAILED);
173 if (cpu_update_mechanism == UM_LAZY) {
174 xbt_swag_remove(action, cpu_modified_set);
175 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action);
180 static void cpu_action_state_set(surf_action_t action,
181 e_surf_action_state_t state)
183 /* if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
184 /* if(((surf_action_lmm_t)action)->variable) { */
185 /* lmm_variable_disable(cpu_maxmin_system, ((surf_action_lmm_t)action)->variable); */
186 /* ((surf_action_lmm_t)action)->variable = NULL; */
189 surf_action_state_set(action, state);
193 static void cpu_update_action_remaining_lazy(surf_action_cpu_Cas01_t action, double now)
197 xbt_assert(GENERIC_ACTION(action).state_set == surf_cpu_model->states.running_action_set,
198 "You're updating an action that is not running.");
200 /* bogus priority, skip it */
201 xbt_assert(GENERIC_ACTION(action).priority > 0,
202 "You're updating an action that seems suspended.");
204 delta = now - GENERIC_LMM_ACTION(action).last_update;
205 if (GENERIC_ACTION(action).remains > 0) {
206 XBT_DEBUG("Updating action(%p): remains was %lf, last_update was: %lf", action,
207 GENERIC_ACTION(action).remains,
208 GENERIC_LMM_ACTION(action).last_update);
209 double_update(&(GENERIC_ACTION(action).remains),
210 GENERIC_LMM_ACTION(action).last_value * delta);
213 if (TRACE_is_enabled()) {
215 lmm_constraint_id(lmm_get_cnst_from_var
217 GENERIC_LMM_ACTION(action).variable, 0));
218 TRACE_surf_host_set_utilization(cpu->generic_resource.name,
219 ((surf_action_t)action)->category,
220 GENERIC_LMM_ACTION(action).last_value,
221 GENERIC_LMM_ACTION(action).last_update,
222 now - GENERIC_LMM_ACTION(action).last_update);
225 XBT_DEBUG("Updating action(%p): remains is now %lf", action,
226 GENERIC_ACTION(action).remains);
228 GENERIC_LMM_ACTION(action).last_update = now;
229 GENERIC_LMM_ACTION(action).last_value = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable);
232 static double cpu_share_resources_lazy(double now)
234 surf_action_cpu_Cas01_t action = NULL;
239 ("Before share resources, the size of modified actions set is %d",
240 xbt_swag_size(cpu_modified_set));
242 lmm_solve(cpu_maxmin_system);
245 ("After share resources, The size of modified actions set is %d",
246 xbt_swag_size(cpu_modified_set));
248 while((action = xbt_swag_extract(cpu_modified_set))) {
249 int max_dur_flag = 0;
251 if (GENERIC_ACTION(action).state_set !=
252 surf_cpu_model->states.running_action_set)
255 /* bogus priority, skip it */
256 if (GENERIC_ACTION(action).priority <= 0)
259 cpu_update_action_remaining_lazy(action,now);
262 value = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable);
264 if (GENERIC_ACTION(action).remains > 0) {
265 value = GENERIC_ACTION(action).remains / value;
273 if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION)
275 || GENERIC_ACTION(action).start +
276 GENERIC_ACTION(action).max_duration < min)) {
277 min = GENERIC_ACTION(action).start +
278 GENERIC_ACTION(action).max_duration;
282 XBT_DEBUG("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
283 GENERIC_ACTION(action).start, now + value,
284 GENERIC_ACTION(action).max_duration);
287 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action);
288 surf_action_lmm_heap_insert(cpu_action_heap,(surf_action_lmm_t)action, min, max_dur_flag ? MAX_DURATION : NORMAL);
289 XBT_DEBUG("Insert at heap action(%p) min %lf now %lf", action, min,
291 } else DIE_IMPOSSIBLE;
294 //hereafter must have already the min value for this resource model
295 if (xbt_heap_size(cpu_action_heap) > 0)
296 min = xbt_heap_maxkey(cpu_action_heap) - now;
300 XBT_DEBUG("The minimum with the HEAP %lf", min);
305 static double cpu_share_resources_full(double now)
307 s_surf_action_cpu_Cas01_t action;
308 return generic_maxmin_share_resources(surf_cpu_model->states.
310 xbt_swag_offset(action,
313 cpu_maxmin_system, lmm_solve);
316 static void cpu_update_actions_state_lazy(double now, double delta)
318 surf_action_cpu_Cas01_t action;
319 while ((xbt_heap_size(cpu_action_heap) > 0)
320 && (double_equals(xbt_heap_maxkey(cpu_action_heap), now))) {
321 action = xbt_heap_pop(cpu_action_heap);
322 XBT_DEBUG("Action %p: finish", action);
323 GENERIC_ACTION(action).finish = surf_get_clock();
325 if (TRACE_is_enabled()) {
327 lmm_constraint_id(lmm_get_cnst_from_var
329 GENERIC_LMM_ACTION(action).variable, 0));
330 TRACE_surf_host_set_utilization(cpu->generic_resource.name,
331 ((surf_action_t)action)->category,
332 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable),
333 GENERIC_LMM_ACTION(action).last_update,
334 now - GENERIC_LMM_ACTION(action).last_update);
337 /* set the remains to 0 due to precision problems when updating the remaining amount */
338 GENERIC_ACTION(action).remains = 0;
339 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
340 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action); //FIXME: strange call since action was already popped
343 if (TRACE_is_enabled()) {
344 //defining the last timestamp that we can safely dump to trace file
345 //without losing the event ascending order (considering all CPU's)
347 xbt_swag_t running_actions = surf_cpu_model->states.running_action_set;
348 xbt_swag_foreach(action, running_actions) {
350 smaller = GENERIC_LMM_ACTION(action).last_update;
353 if (GENERIC_LMM_ACTION(action).last_update < smaller) {
354 smaller = GENERIC_LMM_ACTION(action).last_update;
358 TRACE_last_timestamp_to_dump = smaller;
365 static void cpu_update_actions_state_full(double now, double delta)
367 surf_action_cpu_Cas01_t action = NULL;
368 surf_action_cpu_Cas01_t next_action = NULL;
369 xbt_swag_t running_actions = surf_cpu_model->states.running_action_set;
370 xbt_swag_foreach_safe(action, next_action, running_actions) {
372 if (TRACE_is_enabled()) {
374 lmm_constraint_id(lmm_get_cnst_from_var
376 GENERIC_LMM_ACTION(action).variable, 0));
378 TRACE_surf_host_set_utilization(x->generic_resource.name,
379 ((surf_action_t)action)->category,
380 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).
384 TRACE_last_timestamp_to_dump = now - delta;
387 double_update(&(GENERIC_ACTION(action).remains),
388 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).
390 if (GENERIC_LMM_ACTION(action).generic_action.max_duration !=
392 double_update(&(GENERIC_ACTION(action).max_duration), delta);
393 if ((GENERIC_ACTION(action).remains <= 0) &&
394 (lmm_get_variable_weight(GENERIC_LMM_ACTION(action).variable) >
396 GENERIC_ACTION(action).finish = surf_get_clock();
397 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
398 } else if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION) &&
399 (GENERIC_ACTION(action).max_duration <= 0)) {
400 GENERIC_ACTION(action).finish = surf_get_clock();
401 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
408 static void cpu_update_resource_state(void *id,
409 tmgr_trace_event_t event_type,
410 double value, double date)
412 cpu_Cas01_t cpu = id;
413 lmm_variable_t var = NULL;
414 lmm_element_t elem = NULL;
416 if (event_type == cpu->power_event) {
417 cpu->power_scale = value;
418 lmm_update_constraint_bound(cpu_maxmin_system, cpu->constraint,
419 cpu->core * cpu->power_scale *
422 TRACE_surf_host_set_power(date, cpu->generic_resource.name,
423 cpu->core * cpu->power_scale *
426 while ((var = lmm_get_var_from_cnst
427 (cpu_maxmin_system, cpu->constraint, &elem))) {
428 surf_action_cpu_Cas01_t action = lmm_variable_id(var);
429 lmm_update_variable_bound(cpu_maxmin_system,
430 GENERIC_LMM_ACTION(action).variable,
431 cpu->power_scale * cpu->power_peak);
433 if (tmgr_trace_event_free(event_type))
434 cpu->power_event = NULL;
435 } else if (event_type == cpu->state_event) {
437 cpu->state_current = SURF_RESOURCE_ON;
439 lmm_constraint_t cnst = cpu->constraint;
441 cpu->state_current = SURF_RESOURCE_OFF;
443 while ((var = lmm_get_var_from_cnst(cpu_maxmin_system, cnst, &elem))) {
444 surf_action_t action = lmm_variable_id(var);
446 if (surf_action_state_get(action) == SURF_ACTION_RUNNING ||
447 surf_action_state_get(action) == SURF_ACTION_READY ||
448 surf_action_state_get(action) ==
449 SURF_ACTION_NOT_IN_THE_SYSTEM) {
450 action->finish = date;
451 cpu_action_state_set(action, SURF_ACTION_FAILED);
455 if (tmgr_trace_event_free(event_type))
456 cpu->state_event = NULL;
458 XBT_CRITICAL("Unknown event ! \n");
465 static surf_action_t cpu_execute(void *cpu, double size)
467 surf_action_cpu_Cas01_t action = NULL;
468 cpu_Cas01_t CPU = cpu;
470 XBT_IN("(%s,%g)", surf_resource_name(CPU), size);
472 surf_action_new(sizeof(s_surf_action_cpu_Cas01_t), size,
474 CPU->state_current != SURF_RESOURCE_ON);
476 GENERIC_LMM_ACTION(action).suspended = 0; /* Should be useless because of the
477 calloc but it seems to help valgrind... */
479 GENERIC_LMM_ACTION(action).variable =
480 lmm_variable_new(cpu_maxmin_system, action,
481 GENERIC_ACTION(action).priority,
482 CPU->power_scale * CPU->power_peak, 1);
483 if (cpu_update_mechanism == UM_LAZY) {
484 GENERIC_LMM_ACTION(action).index_heap = -1;
485 GENERIC_LMM_ACTION(action).last_update = surf_get_clock();
486 GENERIC_LMM_ACTION(action).last_value = 0.0;
488 lmm_expand(cpu_maxmin_system, CPU->constraint,
489 GENERIC_LMM_ACTION(action).variable, 1.0);
491 return (surf_action_t) action;
494 static surf_action_t cpu_action_sleep(void *cpu, double duration)
496 surf_action_cpu_Cas01_t action = NULL;
499 duration = MAX(duration, MAXMIN_PRECISION);
501 XBT_IN("(%s,%g)", surf_resource_name(cpu), duration);
502 action = (surf_action_cpu_Cas01_t) cpu_execute(cpu, 1.0);
503 // FIXME: sleep variables should not consume 1.0 in lmm_expand
504 GENERIC_ACTION(action).max_duration = duration;
505 GENERIC_LMM_ACTION(action).suspended = 2;
506 if (duration == NO_MAX_DURATION) {
507 /* Move to the *end* of the corresponding action set. This convention
508 is used to speed up update_resource_state */
509 xbt_swag_remove(action, ((surf_action_t) action)->state_set);
510 ((surf_action_t) action)->state_set =
511 cpu_running_action_set_that_does_not_need_being_checked;
512 xbt_swag_insert(action, ((surf_action_t) action)->state_set);
515 lmm_update_variable_weight(cpu_maxmin_system,
516 GENERIC_LMM_ACTION(action).variable, 0.0);
517 if (cpu_update_mechanism == UM_LAZY) { // remove action from the heap
518 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action);
519 // this is necessary for a variable with weight 0 since such
520 // variables are ignored in lmm and we need to set its max_duration
521 // correctly at the next call to share_resources
522 xbt_swag_insert_at_head(action,cpu_modified_set);
526 return (surf_action_t) action;
529 static void cpu_action_suspend(surf_action_t action)
531 XBT_IN("(%p)", action);
532 if (((surf_action_lmm_t) action)->suspended != 2) {
533 lmm_update_variable_weight(cpu_maxmin_system,
534 ((surf_action_lmm_t) action)->variable,
536 ((surf_action_lmm_t) action)->suspended = 1;
537 if (cpu_update_mechanism == UM_LAZY)
538 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action);
543 static void cpu_action_resume(surf_action_t action)
546 XBT_IN("(%p)", action);
547 if (((surf_action_lmm_t) action)->suspended != 2) {
548 lmm_update_variable_weight(cpu_maxmin_system,
549 ((surf_action_lmm_t) action)->variable,
551 ((surf_action_lmm_t) action)->suspended = 0;
552 if (cpu_update_mechanism == UM_LAZY)
553 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action);
558 static int cpu_action_is_suspended(surf_action_t action)
560 return (((surf_action_lmm_t) action)->suspended == 1);
563 static void cpu_action_set_max_duration(surf_action_t action,
566 XBT_IN("(%p,%g)", action, duration);
568 action->max_duration = duration;
569 if (cpu_update_mechanism == UM_LAZY)
570 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action);
574 static void cpu_action_set_priority(surf_action_t action, double priority)
576 XBT_IN("(%p,%g)", action, priority);
577 action->priority = priority;
578 lmm_update_variable_weight(cpu_maxmin_system,
579 ((surf_action_lmm_t) action)->variable,
582 if (cpu_update_mechanism == UM_LAZY)
583 surf_action_lmm_heap_remove(cpu_action_heap,(surf_action_lmm_t)action);
588 static void cpu_action_set_category(surf_action_t action,
589 const char *category)
591 XBT_IN("(%p,%s)", action, category);
592 action->category = xbt_strdup(category);
597 static double cpu_action_get_remains(surf_action_t action)
599 XBT_IN("(%p)", action);
600 /* update remains before return it */
601 if (cpu_update_mechanism == UM_LAZY)
602 cpu_update_action_remaining_lazy((surf_action_cpu_Cas01_t)action,
605 return action->remains;
608 static e_surf_resource_state_t cpu_get_state(void *cpu)
610 return ((cpu_Cas01_t) cpu)->state_current;
613 static double cpu_get_speed(void *cpu, double load)
615 return load * (((cpu_Cas01_t) cpu)->power_peak);
618 static double cpu_get_available_speed(void *cpu)
620 /* number between 0 and 1 */
621 return ((cpu_Cas01_t) cpu)->power_scale;
624 static void cpu_finalize(void)
626 lmm_system_free(cpu_maxmin_system);
627 cpu_maxmin_system = NULL;
629 surf_model_exit(surf_cpu_model);
630 surf_cpu_model = NULL;
632 xbt_swag_free(cpu_running_action_set_that_does_not_need_being_checked);
633 cpu_running_action_set_that_does_not_need_being_checked = NULL;
635 xbt_heap_free(cpu_action_heap);
636 xbt_swag_free(cpu_modified_set);
639 static void surf_cpu_model_init_internal()
641 s_surf_action_t action;
642 s_surf_action_cpu_Cas01_t comp;
644 surf_cpu_model = surf_model_init();
646 cpu_running_action_set_that_does_not_need_being_checked =
647 xbt_swag_new(xbt_swag_offset(action, state_hookup));
649 surf_cpu_model->name = "cpu";
651 surf_cpu_model->action_unref = cpu_action_unref;
652 surf_cpu_model->action_cancel = cpu_action_cancel;
653 surf_cpu_model->action_state_set = cpu_action_state_set;
655 surf_cpu_model->model_private->resource_used = cpu_resource_used;
657 if (cpu_update_mechanism == UM_LAZY) {
658 surf_cpu_model->model_private->share_resources =
659 cpu_share_resources_lazy;
660 surf_cpu_model->model_private->update_actions_state =
661 cpu_update_actions_state_lazy;
662 } else if (cpu_update_mechanism == UM_FULL) {
663 surf_cpu_model->model_private->share_resources =
664 cpu_share_resources_full;
665 surf_cpu_model->model_private->update_actions_state =
666 cpu_update_actions_state_full;
668 xbt_die("Invalid update mechanism!");
670 surf_cpu_model->model_private->update_resource_state =
671 cpu_update_resource_state;
672 surf_cpu_model->model_private->finalize = cpu_finalize;
674 surf_cpu_model->suspend = cpu_action_suspend;
675 surf_cpu_model->resume = cpu_action_resume;
676 surf_cpu_model->is_suspended = cpu_action_is_suspended;
677 surf_cpu_model->set_max_duration = cpu_action_set_max_duration;
678 surf_cpu_model->set_priority = cpu_action_set_priority;
680 surf_cpu_model->set_category = cpu_action_set_category;
682 surf_cpu_model->get_remains = cpu_action_get_remains;
684 surf_cpu_model->extension.cpu.execute = cpu_execute;
685 surf_cpu_model->extension.cpu.sleep = cpu_action_sleep;
687 surf_cpu_model->extension.cpu.get_state = cpu_get_state;
688 surf_cpu_model->extension.cpu.get_speed = cpu_get_speed;
689 surf_cpu_model->extension.cpu.get_available_speed =
690 cpu_get_available_speed;
691 surf_cpu_model->extension.cpu.create_resource = cpu_create_resource;
692 surf_cpu_model->extension.cpu.add_traces = cpu_add_traces_cpu;
694 if (!cpu_maxmin_system) {
695 cpu_maxmin_system = lmm_system_new(cpu_selective_update);
697 if (cpu_update_mechanism == UM_LAZY) {
698 cpu_action_heap = xbt_heap_new(8, NULL);
699 xbt_heap_set_update_callback(cpu_action_heap,
700 surf_action_lmm_update_index_heap);
702 xbt_swag_new(xbt_swag_offset(comp, generic_lmm_action.action_list_hookup));
703 cpu_maxmin_system->keep_track = cpu_modified_set;
707 /*********************************************************************/
708 /* Basic sharing model for CPU: that is where all this started... ;) */
709 /*********************************************************************/
710 /* @InProceedings{casanova01simgrid, */
711 /* author = "H. Casanova", */
712 /* booktitle = "Proceedings of the IEEE Symposium on Cluster Computing */
713 /* and the Grid (CCGrid'01)", */
714 /* publisher = "IEEE Computer Society", */
715 /* title = "Simgrid: {A} Toolkit for the Simulation of Application */
719 /* note = "Available at */
720 /* \url{http://grail.sdsc.edu/papers/simgrid_ccgrid01.ps.gz}." */
723 void surf_cpu_model_init_Cas01()
725 char *optim = xbt_cfg_get_string(_surf_cfg_set, "cpu/optim");
727 xbt_cfg_get_int(_surf_cfg_set, "cpu/maxmin_selective_update");
729 if (!strcmp(optim, "Full")) {
730 cpu_update_mechanism = UM_FULL;
731 cpu_selective_update = select;
732 } else if (!strcmp(optim, "Lazy")) {
733 cpu_update_mechanism = UM_LAZY;
734 cpu_selective_update = 1;
735 xbt_assert((select == 1)
737 (xbt_cfg_is_default_value
738 (_surf_cfg_set, "cpu/maxmin_selective_update")),
739 "Disabling selective update while using the lazy update mechanism is dumb!");
740 } else if (!strcmp(optim, "TI")) {
741 surf_cpu_model_init_ti();
744 xbt_die("Unsupported optimization (%s) for this model", optim);
749 surf_cpu_model_init_internal();
750 cpu_define_callbacks();
751 xbt_dynar_push(model_list, &surf_cpu_model);