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;
50 /* added to manage the communication action's heap */
51 static void net_action_update_index_heap(void *action, int i)
53 surf_action_cpu_Cas01_t a = action;
54 GENERIC_LMM_ACTION(a).index_heap = i;
57 /* insert action on heap using a given key and a hat (heap_action_type)
58 * a hat can be of three types for communications:
60 * NORMAL = this is a normal heap entry stating the date to finish transmitting
61 * LATENCY = this is a heap entry to warn us when the latency is payed
62 * MAX_DURATION =this is a heap entry to warn us when the max_duration limit is reached
64 static void heap_insert(surf_action_cpu_Cas01_t action, double key,
65 enum heap_action_type hat)
67 GENERIC_LMM_ACTION(action).hat = hat;
68 xbt_heap_push(cpu_action_heap, action, key);
71 static void heap_remove(surf_action_cpu_Cas01_t action)
73 GENERIC_LMM_ACTION(action).hat = NOTSET;
74 if (GENERIC_LMM_ACTION(action).index_heap >= 0) {
75 xbt_heap_remove(cpu_action_heap, GENERIC_LMM_ACTION(action).index_heap);
79 static void *cpu_create_resource(const char *name, double power_peak,
81 tmgr_trace_t power_trace,
83 e_surf_resource_state_t state_initial,
84 tmgr_trace_t state_trace,
85 xbt_dict_t cpu_properties)
87 cpu_Cas01_t cpu = NULL;
89 xbt_assert(!surf_cpu_resource_by_name(name),
90 "Host '%s' declared several times in the platform file",
92 cpu = (cpu_Cas01_t) surf_resource_new(sizeof(s_cpu_Cas01_t),
95 cpu->power_peak = power_peak;
96 xbt_assert(cpu->power_peak > 0, "Power has to be >0");
97 cpu->power_scale = power_scale;
99 xbt_assert(core > 0, "Invalid number of cores %d", core);
103 tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
105 cpu->state_current = state_initial;
108 tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
111 lmm_constraint_new(cpu_maxmin_system, cpu,
112 cpu->core * cpu->power_scale * cpu->power_peak);
114 xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
120 static void parse_cpu_init(sg_platf_host_cbarg_t host)
122 cpu_create_resource(host->id,
128 host->state_trace, host->properties);
131 static void cpu_add_traces_cpu(void)
133 xbt_dict_cursor_t cursor = NULL;
134 char *trace_name, *elm;
135 static int called = 0;
140 /* connect all traces relative to hosts */
141 xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
142 tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
143 cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
145 xbt_assert(host, "Host %s undefined", elm);
146 xbt_assert(trace, "Trace %s undefined", trace_name);
149 tmgr_history_add_trace(history, trace, 0.0, 0, host);
152 xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
153 tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
154 cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
156 xbt_assert(host, "Host %s undefined", elm);
157 xbt_assert(trace, "Trace %s undefined", trace_name);
160 tmgr_history_add_trace(history, trace, 0.0, 0, host);
164 static void cpu_define_callbacks()
166 sg_platf_host_add_cb(parse_cpu_init);
167 sg_platf_postparse_add_cb(cpu_add_traces_cpu);
170 static int cpu_resource_used(void *resource)
172 return lmm_constraint_used(cpu_maxmin_system,
173 ((cpu_Cas01_t) resource)->constraint);
176 static int cpu_action_unref(surf_action_t action)
179 if (!action->refcount) {
180 xbt_swag_remove(action, action->state_set);
181 if (((surf_action_lmm_t) action)->variable)
182 lmm_variable_free(cpu_maxmin_system,
183 ((surf_action_lmm_t) action)->variable);
184 if (cpu_update_mechanism == UM_LAZY) {
185 /* remove from heap */
186 heap_remove((surf_action_cpu_Cas01_t) action);
187 xbt_swag_remove(action, cpu_modified_set);
190 xbt_free(action->category);
192 surf_action_free(&action);
198 static void cpu_action_cancel(surf_action_t action)
200 surf_action_state_set(action, SURF_ACTION_FAILED);
201 if (cpu_update_mechanism == UM_LAZY) {
202 xbt_swag_remove(action, cpu_modified_set);
203 heap_remove((surf_action_cpu_Cas01_t) action);
208 static void cpu_action_state_set(surf_action_t action,
209 e_surf_action_state_t state)
211 /* if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
212 /* if(((surf_action_lmm_t)action)->variable) { */
213 /* lmm_variable_disable(cpu_maxmin_system, ((surf_action_lmm_t)action)->variable); */
214 /* ((surf_action_lmm_t)action)->variable = NULL; */
217 surf_action_state_set(action, state);
221 static void update_action_remaining_lazy(double now)
223 surf_action_cpu_Cas01_t action;
226 xbt_swag_foreach(action, cpu_modified_set) {
227 if (GENERIC_ACTION(action).state_set !=
228 surf_cpu_model->states.running_action_set)
229 continue; // FIXME useless ????
231 /* bogus priority, skip it */
232 if (GENERIC_ACTION(action).priority <= 0)
235 delta = now - GENERIC_LMM_ACTION(action).last_update;
236 if (GENERIC_ACTION(action).remains > 0) {
238 double_update(&(GENERIC_ACTION(action).remains),
239 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable) * delta);
242 if (TRACE_is_enabled()) {
244 lmm_constraint_id(lmm_get_cnst_from_var
246 GENERIC_LMM_ACTION(action).variable, 0));
247 TRACE_surf_host_set_utilization(cpu->generic_resource.name,
248 ((surf_action_t)action)->category,
249 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable),
250 GENERIC_LMM_ACTION(action).last_update,
251 now - GENERIC_LMM_ACTION(action).last_update);
254 XBT_DEBUG("Update action(%p) remains %lf", action,
255 GENERIC_ACTION(action).remains);
257 GENERIC_LMM_ACTION(action).last_update = now;
262 static double cpu_share_resources_lazy(double now)
264 surf_action_cpu_Cas01_t action = NULL;
269 ("Before share resources, the size of modified actions set is %d",
270 xbt_swag_size(cpu_modified_set));
271 update_action_remaining_lazy(now);
273 lmm_solve(cpu_maxmin_system);
276 ("After share resources, The size of modified actions set is %d",
277 xbt_swag_size(cpu_modified_set));
279 xbt_swag_foreach(action, cpu_modified_set) {
280 int max_dur_flag = 0;
282 if (GENERIC_ACTION(action).state_set !=
283 surf_cpu_model->states.running_action_set)
286 /* bogus priority, skip it */
287 if (GENERIC_ACTION(action).priority <= 0)
291 value = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable);
293 if (GENERIC_ACTION(action).remains > 0) {
294 value = GENERIC_ACTION(action).remains / value;
302 if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION)
304 || GENERIC_ACTION(action).start +
305 GENERIC_ACTION(action).max_duration < min)) {
306 min = GENERIC_ACTION(action).start +
307 GENERIC_ACTION(action).max_duration;
311 XBT_DEBUG("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
312 GENERIC_ACTION(action).start, now + value,
313 GENERIC_ACTION(action).max_duration);
317 heap_insert(action, min, max_dur_flag ? MAX_DURATION : NORMAL);
318 XBT_DEBUG("Insert at heap action(%p) min %lf now %lf", action, min,
320 } else DIE_IMPOSSIBLE;
323 //hereafter must have already the min value for this resource model
324 if (xbt_heap_size(cpu_action_heap) > 0)
325 min = xbt_heap_maxkey(cpu_action_heap) - now;
329 XBT_DEBUG("The minimum with the HEAP %lf", min);
334 static double cpu_share_resources_full(double now)
336 s_surf_action_cpu_Cas01_t action;
337 return generic_maxmin_share_resources(surf_cpu_model->states.
339 xbt_swag_offset(action,
342 cpu_maxmin_system, lmm_solve);
345 static void cpu_update_actions_state_lazy(double now, double delta)
347 surf_action_cpu_Cas01_t action;
348 while ((xbt_heap_size(cpu_action_heap) > 0)
349 && (double_equals(xbt_heap_maxkey(cpu_action_heap), now))) {
350 action = xbt_heap_pop(cpu_action_heap);
351 XBT_DEBUG("Action %p: finish", action);
352 GENERIC_ACTION(action).finish = surf_get_clock();
354 if (TRACE_is_enabled()) {
356 lmm_constraint_id(lmm_get_cnst_from_var
358 GENERIC_LMM_ACTION(action).variable, 0));
359 TRACE_surf_host_set_utilization(cpu->generic_resource.name,
360 ((surf_action_t)action)->category,
361 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable),
362 GENERIC_LMM_ACTION(action).last_update,
363 now - GENERIC_LMM_ACTION(action).last_update);
366 /* set the remains to 0 due to precision problems when updating the remaining amount */
367 GENERIC_ACTION(action).remains = 0;
368 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
372 if (TRACE_is_enabled()) {
373 //defining the last timestamp that we can safely dump to trace file
374 //without losing the event ascending order (considering all CPU's)
376 xbt_swag_t running_actions = surf_cpu_model->states.running_action_set;
377 xbt_swag_foreach(action, running_actions) {
379 smaller = GENERIC_LMM_ACTION(action).last_update;
382 if (GENERIC_LMM_ACTION(action).last_update < smaller) {
383 smaller = GENERIC_LMM_ACTION(action).last_update;
387 TRACE_last_timestamp_to_dump = smaller;
394 static void cpu_update_actions_state_full(double now, double delta)
396 surf_action_cpu_Cas01_t action = NULL;
397 surf_action_cpu_Cas01_t next_action = NULL;
398 xbt_swag_t running_actions = surf_cpu_model->states.running_action_set;
399 xbt_swag_foreach_safe(action, next_action, running_actions) {
401 if (TRACE_is_enabled()) {
403 lmm_constraint_id(lmm_get_cnst_from_var
405 GENERIC_LMM_ACTION(action).variable, 0));
407 TRACE_surf_host_set_utilization(x->generic_resource.name,
408 ((surf_action_t)action)->category,
409 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).
413 TRACE_last_timestamp_to_dump = now - delta;
416 double_update(&(GENERIC_ACTION(action).remains),
417 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).
419 if (GENERIC_LMM_ACTION(action).generic_action.max_duration !=
421 double_update(&(GENERIC_ACTION(action).max_duration), delta);
422 if ((GENERIC_ACTION(action).remains <= 0) &&
423 (lmm_get_variable_weight(GENERIC_LMM_ACTION(action).variable) >
425 GENERIC_ACTION(action).finish = surf_get_clock();
426 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
427 } else if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION) &&
428 (GENERIC_ACTION(action).max_duration <= 0)) {
429 GENERIC_ACTION(action).finish = surf_get_clock();
430 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
437 static void cpu_update_resource_state(void *id,
438 tmgr_trace_event_t event_type,
439 double value, double date)
441 cpu_Cas01_t cpu = id;
442 lmm_variable_t var = NULL;
443 lmm_element_t elem = NULL;
445 if (event_type == cpu->power_event) {
446 cpu->power_scale = value;
447 lmm_update_constraint_bound(cpu_maxmin_system, cpu->constraint,
448 cpu->core * cpu->power_scale *
451 TRACE_surf_host_set_power(date, cpu->generic_resource.name,
452 cpu->core * cpu->power_scale *
455 while ((var = lmm_get_var_from_cnst
456 (cpu_maxmin_system, cpu->constraint, &elem))) {
457 surf_action_cpu_Cas01_t action = lmm_variable_id(var);
458 lmm_update_variable_bound(cpu_maxmin_system,
459 GENERIC_LMM_ACTION(action).variable,
460 cpu->power_scale * cpu->power_peak);
462 if (tmgr_trace_event_free(event_type))
463 cpu->power_event = NULL;
464 } else if (event_type == cpu->state_event) {
466 cpu->state_current = SURF_RESOURCE_ON;
468 lmm_constraint_t cnst = cpu->constraint;
470 cpu->state_current = SURF_RESOURCE_OFF;
472 while ((var = lmm_get_var_from_cnst(cpu_maxmin_system, cnst, &elem))) {
473 surf_action_t action = lmm_variable_id(var);
475 if (surf_action_state_get(action) == SURF_ACTION_RUNNING ||
476 surf_action_state_get(action) == SURF_ACTION_READY ||
477 surf_action_state_get(action) ==
478 SURF_ACTION_NOT_IN_THE_SYSTEM) {
479 action->finish = date;
480 cpu_action_state_set(action, SURF_ACTION_FAILED);
484 if (tmgr_trace_event_free(event_type))
485 cpu->state_event = NULL;
487 XBT_CRITICAL("Unknown event ! \n");
494 static surf_action_t cpu_execute(void *cpu, double size)
496 surf_action_cpu_Cas01_t action = NULL;
497 cpu_Cas01_t CPU = cpu;
499 XBT_IN("(%s,%g)", surf_resource_name(CPU), size);
501 surf_action_new(sizeof(s_surf_action_cpu_Cas01_t), size,
503 CPU->state_current != SURF_RESOURCE_ON);
505 GENERIC_LMM_ACTION(action).suspended = 0; /* Should be useless because of the
506 calloc but it seems to help valgrind... */
508 GENERIC_LMM_ACTION(action).variable =
509 lmm_variable_new(cpu_maxmin_system, action,
510 GENERIC_ACTION(action).priority,
511 CPU->power_scale * CPU->power_peak, 1);
512 if (cpu_update_mechanism == UM_LAZY) {
513 GENERIC_LMM_ACTION(action).index_heap = -1;
514 GENERIC_LMM_ACTION(action).last_update = surf_get_clock();
516 lmm_expand(cpu_maxmin_system, CPU->constraint,
517 GENERIC_LMM_ACTION(action).variable, 1.0);
519 return (surf_action_t) action;
522 static surf_action_t cpu_action_sleep(void *cpu, double duration)
524 surf_action_cpu_Cas01_t action = NULL;
527 duration = MAX(duration, MAXMIN_PRECISION);
529 XBT_IN("(%s,%g)", surf_resource_name(cpu), duration);
530 action = (surf_action_cpu_Cas01_t) cpu_execute(cpu, 1.0);
531 GENERIC_ACTION(action).max_duration = duration;
532 GENERIC_LMM_ACTION(action).suspended = 2;
533 if (duration == NO_MAX_DURATION) {
534 /* Move to the *end* of the corresponding action set. This convention
535 is used to speed up update_resource_state */
536 xbt_swag_remove(action, ((surf_action_t) action)->state_set);
537 ((surf_action_t) action)->state_set =
538 cpu_running_action_set_that_does_not_need_being_checked;
539 xbt_swag_insert(action, ((surf_action_t) action)->state_set);
542 lmm_update_variable_weight(cpu_maxmin_system,
543 GENERIC_LMM_ACTION(action).variable, 0.0);
544 if (cpu_update_mechanism == UM_LAZY) { // remove action from the heap
545 heap_remove((surf_action_cpu_Cas01_t) action);
546 // this is necessary for a variable with weight 0 since such
547 // variables are ignored in lmm and we need to set its max_duration
548 // correctly at the next call to share_resources
549 xbt_swag_insert_at_head(action,cpu_modified_set);
553 return (surf_action_t) action;
556 static void cpu_action_suspend(surf_action_t action)
558 XBT_IN("(%p)", action);
559 if (((surf_action_lmm_t) action)->suspended != 2) {
560 lmm_update_variable_weight(cpu_maxmin_system,
561 ((surf_action_lmm_t) action)->variable,
563 ((surf_action_lmm_t) action)->suspended = 1;
564 if (cpu_update_mechanism == UM_LAZY)
565 heap_remove((surf_action_cpu_Cas01_t) action);
570 static void cpu_action_resume(surf_action_t action)
573 XBT_IN("(%p)", action);
574 if (((surf_action_lmm_t) action)->suspended != 2) {
575 lmm_update_variable_weight(cpu_maxmin_system,
576 ((surf_action_lmm_t) action)->variable,
578 ((surf_action_lmm_t) action)->suspended = 0;
579 if (cpu_update_mechanism == UM_LAZY)
580 heap_remove((surf_action_cpu_Cas01_t) action);
585 static int cpu_action_is_suspended(surf_action_t action)
587 return (((surf_action_lmm_t) action)->suspended == 1);
590 static void cpu_action_set_max_duration(surf_action_t action,
593 XBT_IN("(%p,%g)", action, duration);
595 action->max_duration = duration;
596 if (cpu_update_mechanism == UM_LAZY)
597 heap_remove((surf_action_cpu_Cas01_t) action);
601 static void cpu_action_set_priority(surf_action_t action, double priority)
603 XBT_IN("(%p,%g)", action, priority);
604 action->priority = priority;
605 lmm_update_variable_weight(cpu_maxmin_system,
606 ((surf_action_lmm_t) action)->variable,
609 if (cpu_update_mechanism == UM_LAZY)
610 heap_remove((surf_action_cpu_Cas01_t) action);
615 static void cpu_action_set_category(surf_action_t action,
616 const char *category)
618 XBT_IN("(%p,%s)", action, category);
619 action->category = xbt_strdup(category);
624 static double cpu_action_get_remains(surf_action_t action)
626 XBT_IN("(%p)", action);
627 /* update remains before return it */
628 if (cpu_update_mechanism == UM_LAZY)
629 update_action_remaining_lazy(surf_get_clock());
631 return action->remains;
634 static e_surf_resource_state_t cpu_get_state(void *cpu)
636 return ((cpu_Cas01_t) cpu)->state_current;
639 static double cpu_get_speed(void *cpu, double load)
641 return load * (((cpu_Cas01_t) cpu)->power_peak);
644 static double cpu_get_available_speed(void *cpu)
646 /* number between 0 and 1 */
647 return ((cpu_Cas01_t) cpu)->power_scale;
650 static void cpu_finalize(void)
652 lmm_system_free(cpu_maxmin_system);
653 cpu_maxmin_system = NULL;
655 surf_model_exit(surf_cpu_model);
656 surf_cpu_model = NULL;
658 xbt_swag_free(cpu_running_action_set_that_does_not_need_being_checked);
659 cpu_running_action_set_that_does_not_need_being_checked = NULL;
661 xbt_heap_free(cpu_action_heap);
664 static void surf_cpu_model_init_internal()
666 s_surf_action_t action;
667 s_surf_action_cpu_Cas01_t comp;
669 surf_cpu_model = surf_model_init();
671 cpu_running_action_set_that_does_not_need_being_checked =
672 xbt_swag_new(xbt_swag_offset(action, state_hookup));
674 surf_cpu_model->name = "cpu";
676 surf_cpu_model->action_unref = cpu_action_unref;
677 surf_cpu_model->action_cancel = cpu_action_cancel;
678 surf_cpu_model->action_state_set = cpu_action_state_set;
680 surf_cpu_model->model_private->resource_used = cpu_resource_used;
682 if (cpu_update_mechanism == UM_LAZY) {
683 surf_cpu_model->model_private->share_resources =
684 cpu_share_resources_lazy;
685 surf_cpu_model->model_private->update_actions_state =
686 cpu_update_actions_state_lazy;
687 } else if (cpu_update_mechanism == UM_FULL) {
688 surf_cpu_model->model_private->share_resources =
689 cpu_share_resources_full;
690 surf_cpu_model->model_private->update_actions_state =
691 cpu_update_actions_state_full;
693 xbt_die("Invalid update mechanism!");
695 surf_cpu_model->model_private->update_resource_state =
696 cpu_update_resource_state;
697 surf_cpu_model->model_private->finalize = cpu_finalize;
699 surf_cpu_model->suspend = cpu_action_suspend;
700 surf_cpu_model->resume = cpu_action_resume;
701 surf_cpu_model->is_suspended = cpu_action_is_suspended;
702 surf_cpu_model->set_max_duration = cpu_action_set_max_duration;
703 surf_cpu_model->set_priority = cpu_action_set_priority;
705 surf_cpu_model->set_category = cpu_action_set_category;
707 surf_cpu_model->get_remains = cpu_action_get_remains;
709 surf_cpu_model->extension.cpu.execute = cpu_execute;
710 surf_cpu_model->extension.cpu.sleep = cpu_action_sleep;
712 surf_cpu_model->extension.cpu.get_state = cpu_get_state;
713 surf_cpu_model->extension.cpu.get_speed = cpu_get_speed;
714 surf_cpu_model->extension.cpu.get_available_speed =
715 cpu_get_available_speed;
716 surf_cpu_model->extension.cpu.create_resource = cpu_create_resource;
717 surf_cpu_model->extension.cpu.add_traces = cpu_add_traces_cpu;
719 if (!cpu_maxmin_system) {
720 cpu_maxmin_system = lmm_system_new(cpu_selective_update);
722 if (cpu_update_mechanism == UM_LAZY) {
723 cpu_action_heap = xbt_heap_new(8, NULL);
724 xbt_heap_set_update_callback(cpu_action_heap,
725 net_action_update_index_heap);
727 xbt_swag_new(xbt_swag_offset(comp, generic_lmm_action.action_list_hookup));
728 cpu_maxmin_system->keep_track = cpu_modified_set;
732 /*********************************************************************/
733 /* Basic sharing model for CPU: that is where all this started... ;) */
734 /*********************************************************************/
735 /* @InProceedings{casanova01simgrid, */
736 /* author = "H. Casanova", */
737 /* booktitle = "Proceedings of the IEEE Symposium on Cluster Computing */
738 /* and the Grid (CCGrid'01)", */
739 /* publisher = "IEEE Computer Society", */
740 /* title = "Simgrid: {A} Toolkit for the Simulation of Application */
744 /* note = "Available at */
745 /* \url{http://grail.sdsc.edu/papers/simgrid_ccgrid01.ps.gz}." */
748 void surf_cpu_model_init_Cas01()
750 char *optim = xbt_cfg_get_string(_surf_cfg_set, "cpu/optim");
752 xbt_cfg_get_int(_surf_cfg_set, "cpu/maxmin_selective_update");
754 if (!strcmp(optim, "Full")) {
755 cpu_update_mechanism = UM_FULL;
756 cpu_selective_update = select;
757 } else if (!strcmp(optim, "Lazy")) {
758 cpu_update_mechanism = UM_LAZY;
759 cpu_selective_update = 1;
760 xbt_assert((select == 1)
762 (xbt_cfg_is_default_value
763 (_surf_cfg_set, "cpu/maxmin_selective_update")),
764 "Disabling selective update while using the lazy update mechanism is dumb!");
765 } else if (!strcmp(optim, "TI")) {
766 surf_cpu_model_init_ti();
769 xbt_die("Unsupported optimization (%s) for this model", optim);
774 surf_cpu_model_init_internal();
775 cpu_define_callbacks();
776 xbt_dynar_push(model_list, &surf_cpu_model);