surf_model_t surf_cpu_model = NULL;
lmm_system_t cpu_maxmin_system = NULL;
-e_UM_t update_mechanism = UM_LAZY;
+e_UM_t cpu_update_mechanism = UM_FULL;
#undef GENERIC_LMM_ACTION
#undef GENERIC_ACTION
cpu->core * cpu->power_scale * cpu->power_peak);
xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
cpu->action_set = xbt_swag_new(xbt_swag_offset(action, cpu_list_hookup));
return cpu;
if (((surf_action_lmm_t) action)->variable)
lmm_variable_free(cpu_im_maxmin_system,
((surf_action_lmm_t) action)->variable);
- if(update_mechanism == UM_FULL){
+ if(cpu_update_mechanism == UM_LAZY){
/* remove from heap */
xbt_heap_remove(cpu_im_action_heap,
((surf_action_cpu_Cas01_im_t) action)->index_heap);
static void cpu_im_action_cancel(surf_action_t action)
{
surf_action_state_set(action, SURF_ACTION_FAILED);
- if(update_mechanism == UM_FULL){
+ if(cpu_update_mechanism == UM_LAZY){
xbt_heap_remove(cpu_im_action_heap,
((surf_action_cpu_Cas01_im_t) action)->index_heap);
xbt_swag_remove(action,
lmm_update_variable_bound(cpu_im_maxmin_system, GENERIC_LMM_ACTION(action).variable,
cpu->power_scale * cpu->power_peak);
}
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
xbt_swag_insert(cpu, cpu_im_modified_cpu);
if (tmgr_trace_event_free(event_type))
cpu->power_event = NULL;
GENERIC_LMM_ACTION(action).variable =
lmm_variable_new(cpu_im_maxmin_system, action,
GENERIC_ACTION(action).priority, CPU->power_scale * CPU->power_peak, 1);
- if(update_mechanism == UM_FULL){
+ if(cpu_update_mechanism == UM_LAZY){
action->index_heap = -1;
action->cpu = CPU;
xbt_swag_insert(CPU, cpu_im_modified_cpu);
lmm_update_variable_weight(cpu_im_maxmin_system,
GENERIC_LMM_ACTION(action).variable, 0.0);
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
xbt_swag_insert(cpu, cpu_im_modified_cpu);
XBT_OUT();
return (surf_action_t) action;
((surf_action_lmm_t) action)->variable,
0.0);
((surf_action_lmm_t) action)->suspended = 1;
- if(update_mechanism == UM_FULL){
+ if(cpu_update_mechanism == UM_LAZY){
xbt_heap_remove(cpu_im_action_heap,
((surf_action_cpu_Cas01_im_t) action)->index_heap);
xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
((surf_action_lmm_t) action)->variable,
action->priority);
((surf_action_lmm_t) action)->suspended = 0;
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
}
XBT_OUT();
action->max_duration = duration;
/* insert cpu in modified_cpu set to notice the max duration change */
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
XBT_OUT();
}
((surf_action_lmm_t) action)->variable,
priority);
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
XBT_OUT();
}
{
XBT_IN("(%p)", action);
/* update remains before return it */
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
cpu_im_update_remains(ACTION_GET_CPU(action), surf_get_clock());
return action->remains;
XBT_OUT();
sg_maxmin_selective_update = 1;
cpu_im_maxmin_system = lmm_system_new();
}
- if(update_mechanism == UM_FULL){
+ if(cpu_update_mechanism == UM_LAZY){
cpu_im_action_heap = xbt_heap_new(8, NULL);
xbt_heap_set_update_callback(cpu_im_action_heap,
cpu_im_action_update_index_heap);
{
char* name;
if( strcmp(xbt_cfg_get_string(_surf_cfg_set, "cpu/model"),"Cas01"))
- update_mechanism = UM_FULL;
+ cpu_update_mechanism = UM_LAZY;
else
- update_mechanism = UM_LAZY;
+ cpu_update_mechanism = UM_FULL;
if (surf_cpu_model)
return;
double generic_share_resources(double now)
{
surf_action_cpu_Cas01_im_t action;
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
return cpu_im_share_resources(now);
- else if (update_mechanism == UM_LAZY)
+ else if (cpu_update_mechanism == UM_FULL)
{
return generic_maxmin_share_resources(surf_cpu_model->states.running_action_set,
xbt_swag_offset(*action, generic_lmm_action.variable),
void generic_update_actions_state(double now, double delta)
{
- if(update_mechanism == UM_FULL)
+ if(cpu_update_mechanism == UM_LAZY)
cpu_im_update_actions_state(now, delta);
- else if(update_mechanism == UM_LAZY)
+ else if(cpu_update_mechanism == UM_FULL)
{
cpu_update_actions_state(now, delta);
}
xbt_dict_t gap_lookup = NULL;
+e_UM_t network_update_mechanism = UM_FULL;
+
typedef struct network_link_CM02_im {
s_surf_resource_lmm_t lmm_resource; /* must remain first to be added to a trace */
static xbt_heap_t im_net_action_heap = NULL;
xbt_swag_t keep_track = NULL;
extern int sg_maxmin_selective_update;
-extern e_UM_t update_mechanism;
#ifdef HAVE_SMPI
static void gap_append(double size, const link_CM02_im_t link, surf_action_network_CM02_im_t action);
link->state,
link->state_trace,
link->policy,
- NULL); /* FIXME: We need to deep copy the properties or
- * we won't be able to free it */
+ link->properties);
xbt_free(link_id);
}
else{
lmm_variable_free(network_im_maxmin_system,
((surf_action_network_CM02_im_t) action)->variable);
}
- if(update_mechanism == UM_FULL){// remove action from the heap
+ if(network_update_mechanism == UM_LAZY){// remove action from the heap
heap_remove((surf_action_network_CM02_im_t) action);
xbt_swag_remove(action, im_net_modified_set);
}
static void im_net_action_cancel(surf_action_t action)
{
surf_network_model->action_state_set(action, SURF_ACTION_FAILED);
- if(update_mechanism == UM_FULL){// remove action from the heap
+ if(network_update_mechanism == UM_LAZY){// remove action from the heap
xbt_swag_remove(action, im_net_modified_set);
heap_remove((surf_action_network_CM02_im_t) action);
}
double im_net_action_get_remains(surf_action_t action)
{
- if(update_mechanism == UM_FULL)/* update remains before return it */
+ if(network_update_mechanism == UM_LAZY)/* update remains before return it */
update_action_remaining(surf_get_clock());
return action->remains;
}
static double generic_net_share_resources(double now)
{
- if(update_mechanism == UM_FULL)
+ if(network_update_mechanism == UM_LAZY)
return im_net_share_resources(now);
- else if (update_mechanism == UM_LAZY)
+ else if (network_update_mechanism == UM_FULL)
{
return net_share_resources(now);
} else {
static void generic_net_update_actions_state(double now, double delta)
{
- if(update_mechanism == UM_FULL)
+ if(network_update_mechanism == UM_LAZY)
im_net_update_actions_state(now,delta);
- else if (update_mechanism == UM_LAZY)
+ else if (network_update_mechanism == UM_FULL)
{
net_update_actions_state(now,delta);
} else {
xbt_swag_insert(action, action->generic_action.state_set);
action->rate = rate;
- if(update_mechanism == UM_FULL){
+ if(network_update_mechanism == UM_LAZY){
action->index_heap = -1;
action->latency = 0.0;
action->weight = 0.0;
action->variable =
lmm_variable_new(network_im_maxmin_system, action, 0.0, -1.0,
constraints_per_variable);
- if(update_mechanism == UM_FULL){
+ if(network_update_mechanism == UM_LAZY){
// add to the heap the event when the latency is payed
XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency + action->last_update);
heap_insert(action, action->latency + action->last_update, LATENCY);
((surf_action_network_CM02_im_t)
action)->variable, 0.0);
- if(update_mechanism == UM_FULL)// remove action from the heap
+ if(network_update_mechanism == UM_LAZY)// remove action from the heap
heap_remove((surf_action_network_CM02_im_t) action);
}
((surf_action_network_CM02_im_t)
action)->weight);
((surf_action_network_CM02_im_t) action)->suspended = 0;
- if(update_mechanism == UM_FULL)// remove action from the heap
+ if(network_update_mechanism == UM_LAZY)// remove action from the heap
heap_remove((surf_action_network_CM02_im_t) action);
}
}
void im_net_action_set_max_duration(surf_action_t action, double duration)
{
action->max_duration = duration;
- if(update_mechanism == UM_FULL)// remove action from the heap
+ if(network_update_mechanism == UM_LAZY)// remove action from the heap
heap_remove((surf_action_network_CM02_im_t) action);
}
lmm_system_free(network_im_maxmin_system);
network_im_maxmin_system = NULL;
- if(update_mechanism == UM_FULL){
+ if(network_update_mechanism == UM_LAZY){
xbt_heap_free(im_net_action_heap);
xbt_swag_free(im_net_modified_set);
}
SURF_RESOURCE_ON, NULL,
SURF_LINK_FATPIPE, NULL));
- if(update_mechanism == UM_FULL){
+ 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);
/************************************************************************/
void im_surf_network_model_init_LegrandVelho(void)
{
+ if( strcmp(xbt_cfg_get_string(_surf_cfg_set, "network/model"),"LV08"))
+ network_update_mechanism = UM_LAZY;
+ else
+ network_update_mechanism = UM_FULL;
if (surf_network_model)
return;
im_net_define_callbacks();
xbt_dynar_push(model_list, &surf_network_model);
network_im_solve = lmm_solve;
+
+ xbt_cfg_setdefault_double(_surf_cfg_set, "network/latency_factor", 1.0);
+ xbt_cfg_setdefault_double(_surf_cfg_set, "network/bandwidth_factor", 1.0);
+ xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 0.0);
}
void surf_network_model_init_Reno(void)