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"
10 surf_model_t surf_cpu_model = NULL;
11 lmm_system_t cpu_maxmin_system = NULL;
12 e_UM_t cpu_update_mechanism = UM_UNDEFINED;
13 static int cpu_selective_update = 0;
15 static xbt_swag_t cpu_modified_cpu = NULL;
16 static xbt_heap_t cpu_action_heap = NULL;
18 #undef GENERIC_LMM_ACTION
21 #define GENERIC_LMM_ACTION(action) action->generic_lmm_action
22 #define GENERIC_ACTION(action) GENERIC_LMM_ACTION(action).generic_action
23 #define ACTION_GET_CPU(action) ((surf_action_cpu_Cas01_t) action)->cpu
25 typedef struct surf_action_cpu_cas01 {
26 s_surf_action_lmm_t generic_lmm_action;
27 s_xbt_swag_hookup_t cpu_list_hookup;
30 } s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
32 typedef struct cpu_Cas01 {
33 s_surf_resource_t generic_resource;
34 s_xbt_swag_hookup_t modified_cpu_hookup;
37 tmgr_trace_event_t power_event;
39 e_surf_resource_state_t state_current;
40 tmgr_trace_event_t state_event;
41 lmm_constraint_t constraint;
42 xbt_swag_t action_set;
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 static void *cpu_create_resource(const char *name, double power_peak,
56 tmgr_trace_t power_trace,
58 e_surf_resource_state_t state_initial,
59 tmgr_trace_t state_trace,
60 xbt_dict_t cpu_properties)
62 cpu_Cas01_t cpu = NULL;
63 s_surf_action_cpu_Cas01_t action;
65 xbt_assert(!surf_cpu_resource_by_name(name),
66 "Host '%s' declared several times in the platform file",
68 cpu = (cpu_Cas01_t) surf_resource_new(sizeof(s_cpu_Cas01_t),
71 cpu->power_peak = power_peak;
72 xbt_assert(cpu->power_peak > 0, "Power has to be >0");
73 cpu->power_scale = power_scale;
75 xbt_assert(core > 0, "Invalid number of cores %d", core);
79 tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
81 cpu->state_current = state_initial;
84 tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
87 lmm_constraint_new(cpu_maxmin_system, cpu,
88 cpu->core * cpu->power_scale * cpu->power_peak);
90 xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
91 if (cpu_update_mechanism == UM_LAZY)
93 xbt_swag_new(xbt_swag_offset(action, cpu_list_hookup));
99 static void parse_cpu_init(sg_platf_host_cbarg_t host)
101 cpu_create_resource(host->id,
107 host->state_trace, host->properties);
110 static void cpu_add_traces_cpu(void)
112 xbt_dict_cursor_t cursor = NULL;
113 char *trace_name, *elm;
114 static int called = 0;
119 /* connect all traces relative to hosts */
120 xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
121 tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
122 cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
124 xbt_assert(host, "Host %s undefined", elm);
125 xbt_assert(trace, "Trace %s undefined", trace_name);
128 tmgr_history_add_trace(history, trace, 0.0, 0, host);
131 xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
132 tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
133 cpu_Cas01_t host = surf_cpu_resource_by_name(elm);
135 xbt_assert(host, "Host %s undefined", elm);
136 xbt_assert(trace, "Trace %s undefined", trace_name);
139 tmgr_history_add_trace(history, trace, 0.0, 0, host);
143 static void cpu_define_callbacks()
145 sg_platf_host_add_cb(parse_cpu_init);
146 sg_platf_postparse_add_cb(cpu_add_traces_cpu);
149 static int cpu_resource_used(void *resource)
151 return lmm_constraint_used(cpu_maxmin_system,
152 ((cpu_Cas01_t) resource)->constraint);
155 static int cpu_action_unref(surf_action_t action)
158 if (!action->refcount) {
159 xbt_swag_remove(action, action->state_set);
160 if (((surf_action_lmm_t) action)->variable)
161 lmm_variable_free(cpu_maxmin_system,
162 ((surf_action_lmm_t) action)->variable);
163 if (cpu_update_mechanism == UM_LAZY) {
164 /* remove from heap */
165 xbt_heap_remove(cpu_action_heap,
166 ((surf_action_cpu_Cas01_t) action)->index_heap);
167 xbt_swag_remove(action,
168 ((cpu_Cas01_t) ACTION_GET_CPU(action))->action_set);
169 xbt_swag_insert(ACTION_GET_CPU(action), cpu_modified_cpu);
172 xbt_free(action->category);
174 surf_action_free(&action);
180 static void cpu_action_cancel(surf_action_t action)
182 surf_action_state_set(action, SURF_ACTION_FAILED);
183 if (cpu_update_mechanism == UM_LAZY) {
184 xbt_heap_remove(cpu_action_heap,
185 ((surf_action_cpu_Cas01_t) action)->index_heap);
186 xbt_swag_remove(action,
187 ((cpu_Cas01_t) ACTION_GET_CPU(action))->action_set);
192 static void cpu_cpu_action_state_set(surf_action_t action,
193 e_surf_action_state_t state)
195 /* if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
196 /* if(((surf_action_lmm_t)action)->variable) { */
197 /* lmm_variable_disable(cpu_maxmin_system, ((surf_action_lmm_t)action)->variable); */
198 /* ((surf_action_lmm_t)action)->variable = NULL; */
201 surf_action_state_set(action, state);
205 static void cpu_update_remains(cpu_Cas01_t cpu, double now)
207 surf_action_cpu_Cas01_t action;
209 if (cpu->last_update >= now)
211 xbt_swag_foreach(action, cpu->action_set) {
212 if (GENERIC_ACTION(action).state_set !=
213 surf_cpu_model->states.running_action_set)
216 /* bogus priority, skip it */
217 if (GENERIC_ACTION(action).priority <= 0)
220 if (GENERIC_ACTION(action).remains > 0) {
221 double_update(&(GENERIC_ACTION(action).remains),
222 lmm_variable_getvalue(GENERIC_LMM_ACTION
223 (action).variable) * (now -
227 if (TRACE_is_enabled()) {
228 TRACE_surf_host_set_utilization(cpu->generic_resource.name,
229 action->generic_lmm_action.
231 (surf_action_t) action,
232 lmm_variable_getvalue
233 (GENERIC_LMM_ACTION(action).
234 variable), cpu->last_update,
235 now - cpu->last_update);
238 XBT_DEBUG("Update action(%p) remains %lf", action,
239 GENERIC_ACTION(action).remains);
242 cpu->last_update = now;
245 static double cpu_share_resources_lazy(double now)
247 surf_action_cpu_Cas01_t action;
250 cpu_Cas01_t cpu, cpu_next;
252 xbt_swag_foreach(cpu, cpu_modified_cpu)
253 cpu_update_remains(cpu, now);
255 lmm_solve(cpu_maxmin_system);
257 xbt_swag_foreach_safe(cpu, cpu_next, cpu_modified_cpu) {
258 xbt_swag_foreach(action, cpu->action_set) {
259 if (GENERIC_ACTION(action).state_set !=
260 surf_cpu_model->states.running_action_set)
263 /* bogus priority, skip it */
264 if (GENERIC_ACTION(action).priority <= 0)
268 value = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable);
270 if (GENERIC_ACTION(action).remains > 0) {
271 value = GENERIC_ACTION(action).remains / value;
279 if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION)
281 || GENERIC_ACTION(action).start +
282 GENERIC_ACTION(action).max_duration < min))
284 GENERIC_ACTION(action).start +
285 GENERIC_ACTION(action).max_duration;
287 XBT_DEBUG("Action(%p) Start %lf Finish %lf Max_duration %lf", action,
288 GENERIC_ACTION(action).start, now + value,
289 GENERIC_ACTION(action).max_duration);
291 if (action->index_heap >= 0) {
292 surf_action_cpu_Cas01_t heap_act =
293 xbt_heap_remove(cpu_action_heap, action->index_heap);
294 if (heap_act != action)
298 xbt_heap_push(cpu_action_heap, action, min);
299 XBT_DEBUG("Insert at heap action(%p) min %lf", action, min);
302 xbt_swag_remove(cpu, cpu_modified_cpu);
304 return xbt_heap_size(cpu_action_heap) >
305 0 ? xbt_heap_maxkey(cpu_action_heap) - now : -1;
308 static double cpu_share_resources_full(double now)
310 s_surf_action_cpu_Cas01_t action;
311 return generic_maxmin_share_resources(surf_cpu_model->states.
313 xbt_swag_offset(action,
316 cpu_maxmin_system, lmm_solve);
319 static void cpu_update_actions_state_lazy(double now, double delta)
321 surf_action_cpu_Cas01_t action;
322 while ((xbt_heap_size(cpu_action_heap) > 0)
323 && (double_equals(xbt_heap_maxkey(cpu_action_heap), now))) {
324 action = xbt_heap_pop(cpu_action_heap);
325 XBT_DEBUG("Action %p: finish", action);
326 GENERIC_ACTION(action).finish = surf_get_clock();
327 /* set the remains to 0 due to precision problems when updating the remaining amount */
329 if (TRACE_is_enabled()) {
330 cpu_Cas01_t cpu = ((cpu_Cas01_t) (action->cpu));
331 TRACE_surf_host_set_utilization(cpu->generic_resource.name,
332 GENERIC_LMM_ACTION(action).
334 (surf_action_t) action,
335 lmm_variable_getvalue
336 (GENERIC_LMM_ACTION(action).
337 variable), cpu->last_update,
338 now - cpu->last_update);
341 GENERIC_ACTION(action).remains = 0;
342 cpu_cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
343 cpu_update_remains(action->cpu, surf_get_clock());
346 if (TRACE_is_enabled()) {
347 //defining the last timestamp that we can safely dump to trace file
348 //without losing the event ascending order (considering all CPU's)
351 xbt_lib_cursor_t cursor;
354 xbt_lib_foreach(host_lib, cursor, key, data) {
355 if (data[SURF_CPU_LEVEL]) {
356 cpu = data[SURF_CPU_LEVEL];
358 smaller = cpu->last_update;
361 if (cpu->last_update < smaller) {
362 smaller = cpu->last_update;
367 TRACE_last_timestamp_to_dump = smaller;
374 static void cpu_update_actions_state_full(double now, double delta)
376 surf_action_cpu_Cas01_t action = NULL;
377 surf_action_cpu_Cas01_t next_action = NULL;
378 xbt_swag_t running_actions = surf_cpu_model->states.running_action_set;
379 xbt_swag_foreach_safe(action, next_action, running_actions) {
381 if (TRACE_is_enabled()) {
383 lmm_constraint_id(lmm_get_cnst_from_var
385 GENERIC_LMM_ACTION(action).variable, 0));
387 TRACE_surf_host_set_utilization(x->generic_resource.name,
388 GENERIC_ACTION(action).data,
389 (surf_action_t) action,
390 lmm_variable_getvalue
391 (GENERIC_LMM_ACTION(action).
392 variable), now - delta, delta);
393 TRACE_last_timestamp_to_dump = now - delta;
396 double_update(&(GENERIC_ACTION(action).remains),
397 lmm_variable_getvalue(GENERIC_LMM_ACTION(action).
399 if (GENERIC_LMM_ACTION(action).generic_action.max_duration !=
401 double_update(&(GENERIC_ACTION(action).max_duration), delta);
402 if ((GENERIC_ACTION(action).remains <= 0) &&
403 (lmm_get_variable_weight(GENERIC_LMM_ACTION(action).variable) >
405 GENERIC_ACTION(action).finish = surf_get_clock();
406 cpu_cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
407 } else if ((GENERIC_ACTION(action).max_duration != NO_MAX_DURATION) &&
408 (GENERIC_ACTION(action).max_duration <= 0)) {
409 GENERIC_ACTION(action).finish = surf_get_clock();
410 cpu_cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
417 static void cpu_update_resource_state(void *id,
418 tmgr_trace_event_t event_type,
419 double value, double date)
421 cpu_Cas01_t cpu = id;
422 lmm_variable_t var = NULL;
423 lmm_element_t elem = NULL;
425 if (event_type == cpu->power_event) {
426 cpu->power_scale = value;
427 lmm_update_constraint_bound(cpu_maxmin_system, cpu->constraint,
428 cpu->core * cpu->power_scale *
431 TRACE_surf_host_set_power(date, cpu->generic_resource.name,
432 cpu->core * cpu->power_scale *
435 while ((var = lmm_get_var_from_cnst
436 (cpu_maxmin_system, cpu->constraint, &elem))) {
437 surf_action_cpu_Cas01_t action = lmm_variable_id(var);
438 lmm_update_variable_bound(cpu_maxmin_system,
439 GENERIC_LMM_ACTION(action).variable,
440 cpu->power_scale * cpu->power_peak);
442 if (cpu_update_mechanism == UM_LAZY)
443 xbt_swag_insert(cpu, cpu_modified_cpu);
444 if (tmgr_trace_event_free(event_type))
445 cpu->power_event = NULL;
446 } else if (event_type == cpu->state_event) {
448 cpu->state_current = SURF_RESOURCE_ON;
450 lmm_constraint_t cnst = cpu->constraint;
452 cpu->state_current = SURF_RESOURCE_OFF;
454 while ((var = lmm_get_var_from_cnst(cpu_maxmin_system, cnst, &elem))) {
455 surf_action_t action = lmm_variable_id(var);
457 if (surf_action_state_get(action) == SURF_ACTION_RUNNING ||
458 surf_action_state_get(action) == SURF_ACTION_READY ||
459 surf_action_state_get(action) ==
460 SURF_ACTION_NOT_IN_THE_SYSTEM) {
461 action->finish = date;
462 cpu_cpu_action_state_set(action, SURF_ACTION_FAILED);
466 if (tmgr_trace_event_free(event_type))
467 cpu->state_event = NULL;
469 XBT_CRITICAL("Unknown event ! \n");
476 static surf_action_t cpu_execute(void *cpu, double size)
478 surf_action_cpu_Cas01_t action = NULL;
479 cpu_Cas01_t CPU = cpu;
481 XBT_IN("(%s,%g)", surf_resource_name(CPU), size);
483 surf_action_new(sizeof(s_surf_action_cpu_Cas01_t), size,
485 CPU->state_current != SURF_RESOURCE_ON);
487 GENERIC_LMM_ACTION(action).suspended = 0; /* Should be useless because of the
488 calloc but it seems to help valgrind... */
490 GENERIC_LMM_ACTION(action).variable =
491 lmm_variable_new(cpu_maxmin_system, action,
492 GENERIC_ACTION(action).priority,
493 CPU->power_scale * CPU->power_peak, 1);
494 if (cpu_update_mechanism == UM_LAZY) {
495 action->index_heap = -1;
497 xbt_swag_insert(CPU, cpu_modified_cpu);
498 xbt_swag_insert(action, CPU->action_set);
500 lmm_expand(cpu_maxmin_system, CPU->constraint,
501 GENERIC_LMM_ACTION(action).variable, 1.0);
503 return (surf_action_t) action;
506 static surf_action_t cpu_action_sleep(void *cpu, double duration)
508 surf_action_cpu_Cas01_t action = NULL;
511 duration = MAX(duration, MAXMIN_PRECISION);
513 XBT_IN("(%s,%g)", surf_resource_name(cpu), duration);
514 action = (surf_action_cpu_Cas01_t) cpu_execute(cpu, 1.0);
515 GENERIC_ACTION(action).max_duration = duration;
516 GENERIC_LMM_ACTION(action).suspended = 2;
517 if (duration == NO_MAX_DURATION) {
518 /* Move to the *end* of the corresponding action set. This convention
519 is used to speed up update_resource_state */
520 xbt_swag_remove(action, ((surf_action_t) action)->state_set);
521 ((surf_action_t) action)->state_set =
522 cpu_running_action_set_that_does_not_need_being_checked;
523 xbt_swag_insert(action, ((surf_action_t) action)->state_set);
526 lmm_update_variable_weight(cpu_maxmin_system,
527 GENERIC_LMM_ACTION(action).variable, 0.0);
528 if (cpu_update_mechanism == UM_LAZY)
529 xbt_swag_insert(cpu, cpu_modified_cpu);
531 return (surf_action_t) action;
534 static void cpu_action_suspend(surf_action_t action)
536 XBT_IN("(%p)", action);
537 if (((surf_action_lmm_t) action)->suspended != 2) {
538 lmm_update_variable_weight(cpu_maxmin_system,
539 ((surf_action_lmm_t) action)->variable,
541 ((surf_action_lmm_t) action)->suspended = 1;
542 if (cpu_update_mechanism == UM_LAZY) {
543 xbt_heap_remove(cpu_action_heap,
544 ((surf_action_cpu_Cas01_t) action)->index_heap);
545 xbt_swag_insert(ACTION_GET_CPU(action), cpu_modified_cpu);
551 static void cpu_action_resume(surf_action_t action)
554 XBT_IN("(%p)", action);
555 if (((surf_action_lmm_t) action)->suspended != 2) {
556 lmm_update_variable_weight(cpu_maxmin_system,
557 ((surf_action_lmm_t) action)->variable,
559 ((surf_action_lmm_t) action)->suspended = 0;
560 if (cpu_update_mechanism == UM_LAZY)
561 xbt_swag_insert(ACTION_GET_CPU(action), cpu_modified_cpu);
566 static int cpu_action_is_suspended(surf_action_t action)
568 return (((surf_action_lmm_t) action)->suspended == 1);
571 static void cpu_action_set_max_duration(surf_action_t action,
574 XBT_IN("(%p,%g)", action, duration);
576 action->max_duration = duration;
577 /* insert cpu in modified_cpu set to notice the max duration change */
578 if (cpu_update_mechanism == UM_LAZY)
579 xbt_swag_insert(ACTION_GET_CPU(action), cpu_modified_cpu);
583 static void cpu_action_set_priority(surf_action_t action, double priority)
585 XBT_IN("(%p,%g)", action, priority);
586 action->priority = priority;
587 lmm_update_variable_weight(cpu_maxmin_system,
588 ((surf_action_lmm_t) action)->variable,
591 if (cpu_update_mechanism == UM_LAZY)
592 xbt_swag_insert(ACTION_GET_CPU(action), cpu_modified_cpu);
597 static void cpu_action_set_category(surf_action_t action,
598 const char *category)
600 XBT_IN("(%p,%s)", action, category);
601 action->category = xbt_strdup(category);
606 static double cpu_action_get_remains(surf_action_t action)
608 XBT_IN("(%p)", action);
609 /* update remains before return it */
610 if (cpu_update_mechanism == UM_LAZY)
611 cpu_update_remains(ACTION_GET_CPU(action), surf_get_clock());
613 return action->remains;
616 static e_surf_resource_state_t cpu_get_state(void *cpu)
618 return ((cpu_Cas01_t) cpu)->state_current;
621 static double cpu_get_speed(void *cpu, double load)
623 return load * (((cpu_Cas01_t) cpu)->power_peak);
626 static double cpu_get_available_speed(void *cpu)
628 /* number between 0 and 1 */
629 return ((cpu_Cas01_t) cpu)->power_scale;
632 static void cpu_action_update_index_heap(void *action, int i)
634 ((surf_action_cpu_Cas01_t) action)->index_heap = i;
637 static void cpu_finalize(void)
640 xbt_lib_cursor_t cursor;
643 xbt_lib_foreach(host_lib, cursor, key, cpu) {
644 if (cpu[SURF_CPU_LEVEL]) {
645 cpu_Cas01_t CPU = cpu[SURF_CPU_LEVEL];
646 xbt_swag_free(CPU->action_set);
650 lmm_system_free(cpu_maxmin_system);
651 cpu_maxmin_system = NULL;
653 surf_model_exit(surf_cpu_model);
654 surf_cpu_model = NULL;
656 xbt_swag_free(cpu_running_action_set_that_does_not_need_being_checked);
657 cpu_running_action_set_that_does_not_need_being_checked = NULL;
659 xbt_heap_free(cpu_action_heap);
660 if (cpu_modified_cpu)
661 xbt_swag_free(cpu_modified_cpu);
664 static void surf_cpu_model_init_internal()
666 s_surf_action_t action;
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_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 cpu_action_update_index_heap);
727 xbt_swag_new(xbt_swag_offset(cpu, modified_cpu_hookup));
731 /*********************************************************************/
732 /* Basic sharing model for CPU: that is where all this started... ;) */
733 /*********************************************************************/
734 /* @InProceedings{casanova01simgrid, */
735 /* author = "H. Casanova", */
736 /* booktitle = "Proceedings of the IEEE Symposium on Cluster Computing */
737 /* and the Grid (CCGrid'01)", */
738 /* publisher = "IEEE Computer Society", */
739 /* title = "Simgrid: {A} Toolkit for the Simulation of Application */
743 /* note = "Available at */
744 /* \url{http://grail.sdsc.edu/papers/simgrid_ccgrid01.ps.gz}." */
747 void surf_cpu_model_init_Cas01()
749 char *optim = xbt_cfg_get_string(_surf_cfg_set, "cpu/optim");
751 xbt_cfg_get_int(_surf_cfg_set, "cpu/maxmin_selective_update");
753 if (!strcmp(optim, "Full")) {
754 cpu_update_mechanism = UM_FULL;
755 cpu_selective_update = select;
756 } else if (!strcmp(optim, "Lazy")) {
757 cpu_update_mechanism = UM_LAZY;
758 cpu_selective_update = 1;
759 xbt_assert((select == 1)
761 (xbt_cfg_is_default_value
762 (_surf_cfg_set, "cpu/maxmin_selective_update")),
763 "Disabling selective update while using the lazy update mechanism is dumb!");
764 } else if (!strcmp(optim, "TI")) {
765 surf_cpu_model_init_ti();
768 xbt_die("Unsupported optimization (%s) for this model", optim);
773 surf_cpu_model_init_internal();
774 cpu_define_callbacks();
775 xbt_dynar_push(model_list, &surf_cpu_model);