return (fabs(value1 - value2) < MAXMIN_PRECISION);
}
-XBT_PUBLIC(lmm_system_t) lmm_system_new(void);
+XBT_PUBLIC(lmm_system_t) lmm_system_new(int selective_update);
XBT_PUBLIC(void) lmm_system_free(lmm_system_t sys);
void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var);
surf_model_t surf_cpu_model = NULL;
lmm_system_t cpu_maxmin_system = NULL;
e_UM_t cpu_update_mechanism = UM_UNDEFINED;
+static int selective_update = 0;
+
static xbt_swag_t cpu_modified_cpu = NULL;
static xbt_heap_t cpu_action_heap = NULL;
-extern int sg_maxmin_selective_update;
#undef GENERIC_LMM_ACTION
#undef GENERIC_ACTION
surf_cpu_model->extension.cpu.add_traces = cpu_add_traces_cpu;
if (!cpu_maxmin_system) {
- sg_maxmin_selective_update = 1;
- cpu_maxmin_system = lmm_system_new();
+ cpu_maxmin_system = lmm_system_new(selective_update);
}
if(cpu_update_mechanism == UM_LAZY){
cpu_action_heap = xbt_heap_new(8, NULL);
{
char *optim = xbt_cfg_get_string(_surf_cfg_set, "cpu/optim");
char *model = xbt_cfg_get_string(_surf_cfg_set, "cpu/model");
+ int select = xbt_cfg_get_int(_surf_cfg_set, "cpu/maxmin_selective_update");
if(!strcmp(model,"Cas01_fullupdate")) {
XBT_WARN("[*Deprecated*. Use --cfg=cpu/model:Cas01 with option --cfg=cpu/optim:Full instead.]");
if(!strcmp(optim,"Full")) {
cpu_update_mechanism = UM_FULL;
+ selective_update = select;
} else if (!strcmp(optim,"Lazy")) {
cpu_update_mechanism = UM_LAZY;
+ selective_update = 1;
+ xbt_assert((select==1) || (xbt_cfg_is_default_value(_surf_cfg_set,"cpu/maxmin_selective_update")),
+ "Disabling selective update while using the lazy update mechanism is dumb!");
} else if (!strcmp(optim,"TI")) {
surf_cpu_model_init_ti();
return;
static void lmm_update_modified_set(lmm_system_t sys,
lmm_constraint_t cnst);
static void lmm_remove_all_modified_set(lmm_system_t sys);
-int sg_maxmin_selective_update = 1;
static int Global_debug_id = 1;
static int Global_const_debug_id = 1;
extern xbt_swag_t keep_track;
-lmm_system_t lmm_system_new(void)
+lmm_system_t lmm_system_new(int selective_update)
{
lmm_system_t l = NULL;
s_lmm_variable_t var;
l = xbt_new0(s_lmm_system_t, 1);
l->modified = 0;
- l->selective_update_active = sg_maxmin_selective_update;
+ l->selective_update_active = selective_update;
XBT_DEBUG("Setting selective_update_active flag to %d\n",
l->selective_update_active);
xbt_dict_t gap_lookup = NULL;
-e_UM_t network_update_mechanism = UM_FULL;
+e_UM_t network_update_mechanism = UM_UNDEFINED;
+static int selective_update = 0;
typedef struct network_link_CM02_im {
s_surf_resource_lmm_t lmm_resource; /* must remain first to be added to a trace */
static void im_surf_network_model_init_internal(void)
{
s_surf_action_network_CM02_im_t comm;
-
surf_network_model = surf_model_init();
surf_network_model->name = "network";
surf_network_model->extension.network.create_resource =
im_net_create_resource;
- if (!network_im_maxmin_system)
- network_im_maxmin_system = lmm_system_new();
+ if (!network_im_maxmin_system)
+ network_im_maxmin_system = lmm_system_new(selective_update);
routing_model_create(sizeof(link_CM02_im_t),
im_net_create_resource("__loopback__",
SURF_LINK_FATPIPE, NULL));
if(network_update_mechanism == UM_LAZY){
- sg_maxmin_selective_update = 1;
im_net_action_heap = xbt_heap_new(8,NULL);
xbt_heap_set_update_callback(im_net_action_heap, im_net_action_update_index_heap);
im_net_modified_set =
static void set_update_mechanism(void) {
char *optim = xbt_cfg_get_string(_surf_cfg_set, "network/optim");
+ int select = xbt_cfg_get_int(_surf_cfg_set, "network/maxmin_selective_update");
if(!strcmp(optim,"Full")) {
network_update_mechanism = UM_FULL;
+ selective_update = select;
} else if (!strcmp(optim,"Lazy")) {
network_update_mechanism = UM_LAZY;
+ selective_update = 1;
+ xbt_assert((select==1) || (xbt_cfg_is_default_value(_surf_cfg_set,"network/maxmin_selective_update")),
+ "Disabling selective update while using the lazy update mechanism is dumb!");
} else {
xbt_die("Unsupported optimization (%s) for this model",optim);
}
sg_weight_S_parameter = xbt_cfg_get_double(_surf_cfg_set, name);
}
-static void _surf_cfg_cb__surf_maxmin_selective_update(const char *name,
- int pos)
-{
- sg_maxmin_selective_update = xbt_cfg_get_int(_surf_cfg_set, name);
-}
-
/* callback of the inclusion path */
static void _surf_cfg_cb__surf_path(const char *name, int pos)
{
_surf_cfg_cb__surf_path, NULL);
default_value_int = 0;
- xbt_cfg_register(&_surf_cfg_set, "maxmin_selective_update",
- "Update the constraint set propagating recursively to others constraints",
+ xbt_cfg_register(&_surf_cfg_set, "cpu/maxmin_selective_update",
+ "Update the constraint set propagating recursively to others constraints (1 by default when optim is set to lazy)",
xbt_cfgelm_int, &default_value_int, 0, 1,
- _surf_cfg_cb__surf_maxmin_selective_update, NULL);
+ NULL, NULL);
+ default_value_int = 0;
+ xbt_cfg_register(&_surf_cfg_set, "network/maxmin_selective_update",
+ "Update the constraint set propagating recursively to others constraints (1 by default when optim is set to lazy)",
+ xbt_cfgelm_int, &default_value_int, 0, 1,
+ NULL, NULL);
/* do model-check */
default_value_int = 0;
ptask_add_traces;
if (!ptask_maxmin_system)
- ptask_maxmin_system = lmm_system_new();
+ ptask_maxmin_system = lmm_system_new(1);
routing_model_create(sizeof(link_L07_t),
ptask_link_create_resource("__loopback__",
lmm_set_default_protocol_function(func_reno_f, func_reno_fpi,
func_reno_fpi);
- Sys = lmm_system_new();
+ Sys = lmm_system_new(1);
L1 = lmm_constraint_new(Sys, (void *) "L1", a);
L2 = lmm_constraint_new(Sys, (void *) "L2", b);
L3 = lmm_constraint_new(Sys, (void *) "L3", a);
lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
func_reno_fpi);
- Sys = lmm_system_new();
+ Sys = lmm_system_new(1);
CPU1 = lmm_constraint_new(Sys, (void *) "CPU1", 200.0);
CPU2 = lmm_constraint_new(Sys, (void *) "CPU2", 100.0);
lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
func_reno_fpi);
- Sys = lmm_system_new();
+ Sys = lmm_system_new(1);
int *used = xbt_new0(int, nb_cnst);
int i, j, k;
- Sys = lmm_system_new();
+ Sys = lmm_system_new(1);
for (i = 0; i < nb_cnst; i++) {
cnst[i] = lmm_constraint_new(Sys, NULL, float_random(10.0));