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_xbt_swag_hookup_t action_list_hookup;
31 enum heap_action_type hat;
32 } s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
34 typedef struct cpu_Cas01 {
35 s_surf_resource_t generic_resource;
36 s_xbt_swag_hookup_t modified_cpu_hookup;
39 tmgr_trace_event_t power_event;
41 e_surf_resource_state_t state_current;
42 tmgr_trace_event_t state_event;
43 lmm_constraint_t constraint;
44 } s_cpu_Cas01_t, *cpu_Cas01_t;
46 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
47 "Logging specific to the SURF CPU IMPROVED module");
52 cpu_running_action_set_that_does_not_need_being_checked = NULL;
54 /* added to manage the communication action's heap */
55 static void net_action_update_index_heap(void *action, int i)
57 ((surf_action_cpu_Cas01_t) action)->index_heap = i;
60 /* insert action on heap using a given key and a hat (heap_action_type)
61 * a hat can be of three types for communications:
63 * NORMAL = this is a normal heap entry stating the date to finish transmitting
64 * LATENCY = this is a heap entry to warn us when the latency is payed
65 * MAX_DURATION =this is a heap entry to warn us when the max_duration limit is reached
67 static void heap_insert(surf_action_cpu_Cas01_t action, double key,
68 enum heap_action_type hat)
71 xbt_heap_push(cpu_action_heap, action, key);
74 static void heap_remove(surf_action_cpu_Cas01_t action)
77 if (((surf_action_cpu_Cas01_t) action)->index_heap >= 0) {
78 xbt_heap_remove(cpu_action_heap, action->index_heap);
82 static void *cpu_create_resource(const char *name, double power_peak,
84 tmgr_trace_t power_trace,
86 e_surf_resource_state_t state_initial,
87 tmgr_trace_t state_trace,
88 xbt_dict_t cpu_properties)
90 cpu_Cas01_t cpu = NULL;
92 xbt_assert(!surf_cpu_resource_by_name(name),
93 "Host '%s' declared several times in the platform file",
95 cpu = (cpu_Cas01_t) surf_resource_new(sizeof(s_cpu_Cas01_t),
98 cpu->power_peak = power_peak;
99 xbt_assert(cpu->power_peak > 0, "Power has to be >0");
100 cpu->power_scale = power_scale;
102 xbt_assert(core > 0, "Invalid number of cores %d", core);
106 tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
108 cpu->state_current = state_initial;
111 tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
114 lmm_constraint_new(cpu_maxmin_system, cpu,
115 cpu->core * cpu->power_scale * cpu->power_peak);
117 xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
123 static void parse_cpu_init(sg_platf_host_cbarg_t host)
125 cpu_create_resource(host->id,
131 host->state_trace, host->properties);
134 static void cpu_add_traces_cpu(void)
136 xbt_dict_cursor_t cursor = NULL;
137 char *trace_name, *elm;
138 static int called = 0;
143 /* connect all traces relative to hosts */
144 xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
145 tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
146 cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
148 xbt_assert(host, "Host %s undefined", elm);
149 xbt_assert(trace, "Trace %s undefined", trace_name);
152 tmgr_history_add_trace(history, trace, 0.0, 0, host);
155 xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
156 tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
157 cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
159 xbt_assert(host, "Host %s undefined", elm);
160 xbt_assert(trace, "Trace %s undefined", trace_name);
163 tmgr_history_add_trace(history, trace, 0.0, 0, host);
167 static void cpu_define_callbacks()
169 sg_platf_host_add_cb(parse_cpu_init);
170 sg_platf_postparse_add_cb(cpu_add_traces_cpu);
173 static int cpu_resource_used(void *resource)
175 return lmm_constraint_used(cpu_maxmin_system,
176 ((cpu_Cas01_t) resource)->constraint);
179 static int cpu_action_unref(surf_action_t action)
182 if (!action->refcount) {
183 xbt_swag_remove(action, action->state_set);
184 if (((surf_action_lmm_t) action)->variable)
185 lmm_variable_free(cpu_maxmin_system,
186 ((surf_action_lmm_t) action)->variable);
187 if (cpu_update_mechanism == UM_LAZY) {
188 /* remove from heap */
189 heap_remove((surf_action_cpu_Cas01_t) action);
190 xbt_swag_remove(action, cpu_modified_set);
193 xbt_free(action->category);
195 surf_action_free(&action);
201 static void cpu_action_cancel(surf_action_t action)
203 surf_action_state_set(action, SURF_ACTION_FAILED);
204 if (cpu_update_mechanism == UM_LAZY) {
205 xbt_swag_remove(action, cpu_modified_set);
206 heap_remove((surf_action_cpu_Cas01_t) action);
211 static void cpu_action_state_set(surf_action_t action,
212 e_surf_action_state_t state)
214 /* if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
215 /* if(((surf_action_lmm_t)action)->variable) { */
216 /* lmm_variable_disable(cpu_maxmin_system, ((surf_action_lmm_t)action)->variable); */
217 /* ((surf_action_lmm_t)action)->variable = NULL; */
220 surf_action_state_set(action, state);
224 static void update_action_remaining_lazy(double now)
226 surf_action_cpu_Cas01_t action;
229 xbt_swag_foreach(action, cpu_modified_set) {
230 if (GENERIC_ACTION(action).state_set !=
231 surf_cpu_model->states.running_action_set)
232 continue; // FIXME useless ????
234 /* bogus priority, skip it */
235 if (GENERIC_ACTION(action).priority <= 0)
238 delta = now - action->last_update;
239 if (GENERIC_ACTION(action).remains > 0) {
241 double_update(&(GENERIC_ACTION(action).remains),
242 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable) * delta);
245 if (TRACE_is_enabled()) {
246 TRACE_surf_host_set_utilization(cpu->generic_resource.name,
247 action->generic_lmm_action.
249 (surf_action_t) action,
250 lmm_variable_getvalue
251 (GENERIC_LMM_ACTION(action).
252 variable), cpu->last_update,
253 now - cpu->last_update);
256 XBT_DEBUG("Update action(%p) remains %lf", action,
257 GENERIC_ACTION(action).remains);
259 action->last_update = now;
264 static double cpu_share_resources_lazy(double now)
266 surf_action_cpu_Cas01_t action = NULL;
271 ("Before share resources, the size of modified actions set is %d",
272 xbt_swag_size(cpu_modified_set));
273 update_action_remaining_lazy(now);
275 lmm_solve(cpu_maxmin_system);
278 ("After share resources, The size of modified actions set is %d",
279 xbt_swag_size(cpu_modified_set));
281 xbt_swag_foreach(action, cpu_modified_set) {
282 int max_dur_flag = 0;
284 if (GENERIC_ACTION(action).state_set !=
285 surf_cpu_model->states.running_action_set)
288 /* bogus priority, skip it */
289 if (GENERIC_ACTION(action).priority <= 0)
293 value = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable);
295 if (GENERIC_ACTION(action).remains > 0) {
296 value = GENERIC_ACTION(action).remains / value;
304 if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION)
306 || GENERIC_ACTION(action).start +
307 GENERIC_ACTION(action).max_duration < min)) {
308 min = GENERIC_ACTION(action).start +
309 GENERIC_ACTION(action).max_duration;
313 XBT_DEBUG("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
314 GENERIC_ACTION(action).start, now + value,
315 GENERIC_ACTION(action).max_duration);
317 if (action->index_heap >= 0) {
322 heap_insert(action, min, max_dur_flag ? MAX_DURATION : NORMAL);
323 XBT_DEBUG("Insert at heap action(%p) min %lf now %lf", action, min,
328 //hereafter must have already the min value for this resource model
329 if (xbt_heap_size(cpu_action_heap) > 0)
330 min = xbt_heap_maxkey(cpu_action_heap) - now;
334 XBT_DEBUG("The minimum with the HEAP %lf", min);
339 static double cpu_share_resources_full(double now)
341 s_surf_action_cpu_Cas01_t action;
342 return generic_maxmin_share_resources(surf_cpu_model->states.
344 xbt_swag_offset(action,
347 cpu_maxmin_system, lmm_solve);
350 static void cpu_update_actions_state_lazy(double now, double delta)
352 surf_action_cpu_Cas01_t action;
353 while ((xbt_heap_size(cpu_action_heap) > 0)
354 && (double_equals(xbt_heap_maxkey(cpu_action_heap), now))) {
355 action = xbt_heap_pop(cpu_action_heap);
356 XBT_DEBUG("Action %p: finish", action);
357 GENERIC_ACTION(action).finish = surf_get_clock();
358 /* set the remains to 0 due to precision problems when updating the remaining amount */
360 if (TRACE_is_enabled()) {
361 cpu_Cas01_t cpu = ((cpu_Cas01_t) (action->cpu));
362 TRACE_surf_host_set_utilization(cpu->generic_resource.name,
363 GENERIC_LMM_ACTION(action).
365 (surf_action_t) action,
366 lmm_variable_getvalue
367 (GENERIC_LMM_ACTION(action).
368 variable), cpu->last_update,
369 now - cpu->last_update);
372 GENERIC_ACTION(action).remains = 0;
373 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
374 // heap_remove(action); //FIXME heap
377 if (TRACE_is_enabled()) {
378 //defining the last timestamp that we can safely dump to trace file
379 //without losing the event ascending order (considering all CPU's)
382 xbt_lib_cursor_t cursor;
385 xbt_lib_foreach(host_lib, cursor, key, data) {
386 if (data[SURF_CPU_LEVEL]) {
387 cpu = data[SURF_CPU_LEVEL];
389 smaller = cpu->last_update;
392 if (cpu->last_update < smaller) {
393 smaller = cpu->last_update;
398 TRACE_last_timestamp_to_dump = smaller;
405 static void cpu_update_actions_state_full(double now, double delta)
407 surf_action_cpu_Cas01_t action = NULL;
408 surf_action_cpu_Cas01_t next_action = NULL;
409 xbt_swag_t running_actions = surf_cpu_model->states.running_action_set;
410 xbt_swag_foreach_safe(action, next_action, running_actions) {
412 if (TRACE_is_enabled()) {
414 lmm_constraint_id(lmm_get_cnst_from_var
416 GENERIC_LMM_ACTION(action).variable, 0));
418 TRACE_surf_host_set_utilization(x->generic_resource.name,
419 GENERIC_ACTION(action).data,
420 (surf_action_t) action,
421 lmm_variable_getvalue
422 (GENERIC_LMM_ACTION(action).
423 variable), now - delta, delta);
424 TRACE_last_timestamp_to_dump = now - delta;
427 double_update(&(GENERIC_ACTION(action).remains),
428 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).
430 if (GENERIC_LMM_ACTION(action).generic_action.max_duration !=
432 double_update(&(GENERIC_ACTION(action).max_duration), delta);
433 if ((GENERIC_ACTION(action).remains <= 0) &&
434 (lmm_get_variable_weight(GENERIC_LMM_ACTION(action).variable) >
436 GENERIC_ACTION(action).finish = surf_get_clock();
437 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
438 } else if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION) &&
439 (GENERIC_ACTION(action).max_duration <= 0)) {
440 GENERIC_ACTION(action).finish = surf_get_clock();
441 cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
448 static void cpu_update_resource_state(void *id,
449 tmgr_trace_event_t event_type,
450 double value, double date)
452 cpu_Cas01_t cpu = id;
453 lmm_variable_t var = NULL;
454 lmm_element_t elem = NULL;
456 if (event_type == cpu->power_event) {
457 cpu->power_scale = value;
458 lmm_update_constraint_bound(cpu_maxmin_system, cpu->constraint,
459 cpu->core * cpu->power_scale *
462 TRACE_surf_host_set_power(date, cpu->generic_resource.name,
463 cpu->core * cpu->power_scale *
466 while ((var = lmm_get_var_from_cnst
467 (cpu_maxmin_system, cpu->constraint, &elem))) {
468 surf_action_cpu_Cas01_t action = lmm_variable_id(var);
469 lmm_update_variable_bound(cpu_maxmin_system,
470 GENERIC_LMM_ACTION(action).variable,
471 cpu->power_scale * cpu->power_peak);
473 if (tmgr_trace_event_free(event_type))
474 cpu->power_event = NULL;
475 } else if (event_type == cpu->state_event) {
477 cpu->state_current = SURF_RESOURCE_ON;
479 lmm_constraint_t cnst = cpu->constraint;
481 cpu->state_current = SURF_RESOURCE_OFF;
483 while ((var = lmm_get_var_from_cnst(cpu_maxmin_system, cnst, &elem))) {
484 surf_action_t action = lmm_variable_id(var);
486 if (surf_action_state_get(action) == SURF_ACTION_RUNNING ||
487 surf_action_state_get(action) == SURF_ACTION_READY ||
488 surf_action_state_get(action) ==
489 SURF_ACTION_NOT_IN_THE_SYSTEM) {
490 action->finish = date;
491 cpu_action_state_set(action, SURF_ACTION_FAILED);
495 if (tmgr_trace_event_free(event_type))
496 cpu->state_event = NULL;
498 XBT_CRITICAL("Unknown event ! \n");
505 static surf_action_t cpu_execute(void *cpu, double size)
507 surf_action_cpu_Cas01_t action = NULL;
508 cpu_Cas01_t CPU = cpu;
510 XBT_IN("(%s,%g)", surf_resource_name(CPU), size);
512 surf_action_new(sizeof(s_surf_action_cpu_Cas01_t), size,
514 CPU->state_current != SURF_RESOURCE_ON);
516 GENERIC_LMM_ACTION(action).suspended = 0; /* Should be useless because of the
517 calloc but it seems to help valgrind... */
519 GENERIC_LMM_ACTION(action).variable =
520 lmm_variable_new(cpu_maxmin_system, action,
521 GENERIC_ACTION(action).priority,
522 CPU->power_scale * CPU->power_peak, 1);
523 if (cpu_update_mechanism == UM_LAZY) {
524 action->index_heap = -1;
525 action->last_update = surf_get_clock();
527 lmm_expand(cpu_maxmin_system, CPU->constraint,
528 GENERIC_LMM_ACTION(action).variable, 1.0);
530 return (surf_action_t) action;
533 static surf_action_t cpu_action_sleep(void *cpu, double duration)
535 surf_action_cpu_Cas01_t action = NULL;
538 duration = MAX(duration, MAXMIN_PRECISION);
540 XBT_IN("(%s,%g)", surf_resource_name(cpu), duration);
541 action = (surf_action_cpu_Cas01_t) cpu_execute(cpu, 1.0);
542 GENERIC_ACTION(action).max_duration = duration;
543 GENERIC_LMM_ACTION(action).suspended = 2;
544 if (duration == NO_MAX_DURATION) {
545 /* Move to the *end* of the corresponding action set. This convention
546 is used to speed up update_resource_state */
547 xbt_swag_remove(action, ((surf_action_t) action)->state_set);
548 ((surf_action_t) action)->state_set =
549 cpu_running_action_set_that_does_not_need_being_checked;
550 xbt_swag_insert(action, ((surf_action_t) action)->state_set);
553 lmm_update_variable_weight(cpu_maxmin_system,
554 GENERIC_LMM_ACTION(action).variable, 0.0);
555 if (cpu_update_mechanism == UM_LAZY) // remove action from the heap
556 heap_remove((surf_action_cpu_Cas01_t) action);
559 return (surf_action_t) action;
562 static void cpu_action_suspend(surf_action_t action)
564 XBT_IN("(%p)", action);
565 if (((surf_action_lmm_t) action)->suspended != 2) {
566 lmm_update_variable_weight(cpu_maxmin_system,
567 ((surf_action_lmm_t) action)->variable,
569 ((surf_action_lmm_t) action)->suspended = 1;
570 if (cpu_update_mechanism == UM_LAZY)
571 heap_remove((surf_action_cpu_Cas01_t) action);
576 static void cpu_action_resume(surf_action_t action)
579 XBT_IN("(%p)", action);
580 if (((surf_action_lmm_t) action)->suspended != 2) {
581 lmm_update_variable_weight(cpu_maxmin_system,
582 ((surf_action_lmm_t) action)->variable,
584 ((surf_action_lmm_t) action)->suspended = 0;
585 if (cpu_update_mechanism == UM_LAZY)
586 heap_remove((surf_action_cpu_Cas01_t) action);
591 static int cpu_action_is_suspended(surf_action_t action)
593 return (((surf_action_lmm_t) action)->suspended == 1);
596 static void cpu_action_set_max_duration(surf_action_t action,
599 XBT_IN("(%p,%g)", action, duration);
601 action->max_duration = duration;
602 /* insert cpu in modified_cpu set to notice the max duration change */
603 if (cpu_update_mechanism == UM_LAZY)
604 heap_remove((surf_action_cpu_Cas01_t) action);
608 static void cpu_action_set_priority(surf_action_t action, double priority)
610 XBT_IN("(%p,%g)", action, priority);
611 action->priority = priority;
612 lmm_update_variable_weight(cpu_maxmin_system,
613 ((surf_action_lmm_t) action)->variable,
616 if (cpu_update_mechanism == UM_LAZY)
617 heap_remove((surf_action_cpu_Cas01_t) action);
622 static void cpu_action_set_category(surf_action_t action,
623 const char *category)
625 XBT_IN("(%p,%s)", action, category);
626 action->category = xbt_strdup(category);
631 static double cpu_action_get_remains(surf_action_t action)
633 XBT_IN("(%p)", action);
634 /* update remains before return it */
635 if (cpu_update_mechanism == UM_LAZY)
636 update_action_remaining_lazy(surf_get_clock());
638 return action->remains;
641 static e_surf_resource_state_t cpu_get_state(void *cpu)
643 return ((cpu_Cas01_t) cpu)->state_current;
646 static double cpu_get_speed(void *cpu, double load)
648 return load * (((cpu_Cas01_t) cpu)->power_peak);
651 static double cpu_get_available_speed(void *cpu)
653 /* number between 0 and 1 */
654 return ((cpu_Cas01_t) cpu)->power_scale;
657 static void cpu_action_update_index_heap(void *action, int i)
659 ((surf_action_cpu_Cas01_t) action)->index_heap = i;
662 static void cpu_finalize(void)
664 lmm_system_free(cpu_maxmin_system);
665 cpu_maxmin_system = NULL;
667 surf_model_exit(surf_cpu_model);
668 surf_cpu_model = NULL;
670 xbt_swag_free(cpu_running_action_set_that_does_not_need_being_checked);
671 cpu_running_action_set_that_does_not_need_being_checked = NULL;
673 xbt_heap_free(cpu_action_heap);
676 static void surf_cpu_model_init_internal()
678 s_surf_action_t action;
679 s_surf_action_cpu_Cas01_t comp;
681 surf_cpu_model = surf_model_init();
683 cpu_running_action_set_that_does_not_need_being_checked =
684 xbt_swag_new(xbt_swag_offset(action, state_hookup));
686 surf_cpu_model->name = "cpu";
688 surf_cpu_model->action_unref = cpu_action_unref;
689 surf_cpu_model->action_cancel = cpu_action_cancel;
690 surf_cpu_model->action_state_set = cpu_action_state_set;
692 surf_cpu_model->model_private->resource_used = cpu_resource_used;
694 if (cpu_update_mechanism == UM_LAZY) {
695 surf_cpu_model->model_private->share_resources =
696 cpu_share_resources_lazy;
697 surf_cpu_model->model_private->update_actions_state =
698 cpu_update_actions_state_lazy;
699 } else if (cpu_update_mechanism == UM_FULL) {
700 surf_cpu_model->model_private->share_resources =
701 cpu_share_resources_full;
702 surf_cpu_model->model_private->update_actions_state =
703 cpu_update_actions_state_full;
705 xbt_die("Invalid update mechanism!");
707 surf_cpu_model->model_private->update_resource_state =
708 cpu_update_resource_state;
709 surf_cpu_model->model_private->finalize = cpu_finalize;
711 surf_cpu_model->suspend = cpu_action_suspend;
712 surf_cpu_model->resume = cpu_action_resume;
713 surf_cpu_model->is_suspended = cpu_action_is_suspended;
714 surf_cpu_model->set_max_duration = cpu_action_set_max_duration;
715 surf_cpu_model->set_priority = cpu_action_set_priority;
717 surf_cpu_model->set_category = cpu_action_set_category;
719 surf_cpu_model->get_remains = cpu_action_get_remains;
721 surf_cpu_model->extension.cpu.execute = cpu_execute;
722 surf_cpu_model->extension.cpu.sleep = cpu_action_sleep;
724 surf_cpu_model->extension.cpu.get_state = cpu_get_state;
725 surf_cpu_model->extension.cpu.get_speed = cpu_get_speed;
726 surf_cpu_model->extension.cpu.get_available_speed =
727 cpu_get_available_speed;
728 surf_cpu_model->extension.cpu.create_resource = cpu_create_resource;
729 surf_cpu_model->extension.cpu.add_traces = cpu_add_traces_cpu;
731 if (!cpu_maxmin_system) {
732 cpu_maxmin_system = lmm_system_new(cpu_selective_update);
734 if (cpu_update_mechanism == UM_LAZY) {
735 cpu_action_heap = xbt_heap_new(8, NULL);
736 xbt_heap_set_update_callback(cpu_action_heap,
737 cpu_action_update_index_heap);
739 xbt_swag_new(xbt_swag_offset(comp, action_list_hookup));
740 cpu_maxmin_system->keep_track = cpu_modified_set;
744 /*********************************************************************/
745 /* Basic sharing model for CPU: that is where all this started... ;) */
746 /*********************************************************************/
747 /* @InProceedings{casanova01simgrid, */
748 /* author = "H. Casanova", */
749 /* booktitle = "Proceedings of the IEEE Symposium on Cluster Computing */
750 /* and the Grid (CCGrid'01)", */
751 /* publisher = "IEEE Computer Society", */
752 /* title = "Simgrid: {A} Toolkit for the Simulation of Application */
756 /* note = "Available at */
757 /* \url{http://grail.sdsc.edu/papers/simgrid_ccgrid01.ps.gz}." */
760 void surf_cpu_model_init_Cas01()
762 char *optim = xbt_cfg_get_string(_surf_cfg_set, "cpu/optim");
764 xbt_cfg_get_int(_surf_cfg_set, "cpu/maxmin_selective_update");
766 if (!strcmp(optim, "Full")) {
767 cpu_update_mechanism = UM_FULL;
768 cpu_selective_update = select;
769 } else if (!strcmp(optim, "Lazy")) {
770 cpu_update_mechanism = UM_LAZY;
771 cpu_selective_update = 1;
772 xbt_assert((select == 1)
774 (xbt_cfg_is_default_value
775 (_surf_cfg_set, "cpu/maxmin_selective_update")),
776 "Disabling selective update while using the lazy update mechanism is dumb!");
777 } else if (!strcmp(optim, "TI")) {
778 surf_cpu_model_init_ti();
781 xbt_die("Unsupported optimization (%s) for this model", optim);
786 surf_cpu_model_init_internal();
787 cpu_define_callbacks();
788 xbt_dynar_push(model_list, &surf_cpu_model);