tmgr_trace_t state_trace,
double interference_send,
double interference_recv,
- double interference_send_recv)
+ double interference_send_recv,
+ double max_outgoing_rate)
{
workstation_KCCFLN05_t workstation = xbt_new0(s_workstation_KCCFLN05_t, 1);
workstation->constraint =
lmm_constraint_new(maxmin_system_cpu_KCCFLN05, workstation,
workstation->power_current * workstation->power_scale);
+ if(max_outgoing_rate>0)
+ workstation->bus=
+ lmm_constraint_new(maxmin_system_cpu_KCCFLN05, workstation,
+ max_outgoing_rate);
workstation->incomming_communications =
xbt_dynar_new(sizeof(surf_action_network_KCCFLN05_t),NULL);
double interference_send = 0.0;
double interference_recv = 0.0;
double interference_send_recv = 0.0;
-
+ double max_outgoing_rate = -1.0;
+
surf_parse_get_double(&power_scale,A_cpu_power);
surf_parse_get_double(&power_initial,A_cpu_availability);
surf_parse_get_trace(&power_trace,A_cpu_availability_file);
surf_parse_get_double(&interference_send,A_cpu_interference_send);
surf_parse_get_double(&interference_recv,A_cpu_interference_recv);
surf_parse_get_double(&interference_send_recv,A_cpu_interference_send_recv);
+ surf_parse_get_double(&max_outgoing_rate,A_cpu_max_outgoing_rate);
workstation_new(A_cpu_name, power_scale, power_initial, power_trace, state_initial,
state_trace, interference_send, interference_recv,
- interference_send_recv);
+ interference_send_recv, max_outgoing_rate);
}
/*********** resource management ***********/
surf_network_resource->common_public->states.failed_action_set;
xbt_swag_foreach_safe(action, next_action, running_actions) {
- action->generic_action.remains -=
- lmm_variable_getvalue(action->variable) * delta;
+ surf_double_update(&(action->generic_action.remains),
+ lmm_variable_getvalue(action->variable) * delta);
if (action->generic_action.max_duration != NO_MAX_DURATION)
- action->generic_action.max_duration -= delta;
- if ((action->generic_action.remains <= 0) &&
+ surf_double_update(&(action->generic_action.max_duration), delta);
+ if ((action->generic_action.remains <= 0.0) &&
(lmm_get_variable_weight(action->variable)>0)) {
action->generic_action.finish = surf_get_clock();
action_network_KCCFLN05_change_state((surf_action_t) action, SURF_ACTION_DONE);
} else if ((action->generic_action.max_duration != NO_MAX_DURATION) &&
- (action->generic_action.max_duration <= 0)) {
+ (action->generic_action.max_duration <= 0.0)) {
action->generic_action.finish = surf_get_clock();
action_network_KCCFLN05_change_state((surf_action_t) action, SURF_ACTION_DONE);
} else { /* Need to check that none of the resource has failed */
return;
}
-static surf_action_t communicate_KCCFLN05(void *src, void *dst, double size)
+static surf_action_t communicate_KCCFLN05(void *src, void *dst, double size,
+ double rate)
{
surf_action_network_KCCFLN05_t action = NULL;
workstation_KCCFLN05_t card_src = src;
xbt_swag_insert(action, action->generic_action.state_set);
- action->variable = lmm_variable_new(maxmin_system_network_KCCFLN05, action, 1.0, -1.0,
- route->size);
+ if(rate>0)
+ action->variable = lmm_variable_new(maxmin_system_network_KCCFLN05, action, 1.0, rate,
+ route->size+1);
+ else
+ action->variable = lmm_variable_new(maxmin_system_network_KCCFLN05, action, 1.0, -1.0,
+ route->size+1);
for (i = 0; i < route->size; i++)
lmm_expand(maxmin_system_network_KCCFLN05, route->links[i]->constraint,
action->variable, 1.0);
+ if(card_src->bus)
+ lmm_expand(maxmin_system_network_KCCFLN05, card_src->bus,
+ action->variable, 1.0);
+
action->src=src;
action->dst=dst;
return (surf_action_t) action;
}
+static void network_KCCFLN05_action_suspend(surf_action_t action)
+{
+ lmm_update_variable_weight(maxmin_system_network_KCCFLN05,
+ ((surf_action_network_KCCFLN05_t) action)->variable, 0.0);
+}
+
+static void network_KCCFLN05_action_resume(surf_action_t action)
+{
+ lmm_update_variable_weight(maxmin_system_network_KCCFLN05,
+ ((surf_action_network_KCCFLN05_t) action)->variable, 1.0);
+}
+
+static int network_KCCFLN05_action_is_suspended(surf_action_t action)
+{
+ return (lmm_get_variable_weight(((surf_action_network_KCCFLN05_t) action)->variable) == 0.0);
+}
+
/***************** CPU ****************/
static void action_cpu_KCCFLN05_free(surf_action_t action)
{
scale -= ROUTE(action->src->id,action->dst->id).impact_on_src *
lmm_variable_getvalue(action->variable);
}
- xbt_assert0(scale>0.0,"Negative interference !");
+ if(scale<0.0) scale=0.0;
+ xbt_assert0(scale>=0.0,"Negative interference !");
} else if((xbt_dynar_length(workstation->incomming_communications)) &&
(!xbt_dynar_length(workstation->outgoing_communications))) {
scale = workstation->interference_recv;
scale -= ROUTE(action->src->id,action->dst->id).impact_on_dst *
lmm_variable_getvalue(action->variable);
}
- xbt_assert0(scale>0.0,"Negative interference !");
+ if(scale<0.0) scale=0.0;
+ xbt_assert0(scale>=0.0,"Negative interference !");
} else {
scale = workstation->interference_send_recv;
xbt_dynar_foreach (workstation->outgoing_communications,cpt,action) {
scale -= ROUTE(action->src->id,action->dst->id).impact_on_dst_with_other_send *
lmm_variable_getvalue(action->variable);
}
- xbt_assert0(scale>0.0,"Negative interference !");
+ if(scale<0.0) scale=0.0;
+ xbt_assert0(scale>=0.0,"Negative interference !");
}
lmm_update_constraint_bound(maxmin_system_cpu_KCCFLN05,workstation->constraint,
W*scale);
surf_cpu_resource->common_public->states.failed_action_set;
xbt_swag_foreach_safe(action, next_action, running_actions) {
- action->generic_action.remains -=
- lmm_variable_getvalue(action->variable) * delta;
+ surf_double_update(&(action->generic_action.remains),
+ lmm_variable_getvalue(action->variable) * delta);
if (action->generic_action.max_duration != NO_MAX_DURATION)
action->generic_action.max_duration -= delta;
if ((action->generic_action.remains <= 0) &&
static void cpu_KCCFLN05_action_suspend(surf_action_t action)
{
- if(action->resource_type==(surf_resource_t)surf_network_resource)
- lmm_update_variable_weight(maxmin_system_network_KCCFLN05,
- ((surf_action_network_KCCFLN05_t) action)->variable, 0.0);
- else if(action->resource_type==(surf_resource_t)surf_cpu_resource)
- lmm_update_variable_weight(maxmin_system_cpu_KCCFLN05,
- ((surf_action_cpu_KCCFLN05_t) action)->variable, 0.0);
- else DIE_IMPOSSIBLE;
+ lmm_update_variable_weight(maxmin_system_cpu_KCCFLN05,
+ ((surf_action_cpu_KCCFLN05_t) action)->variable, 0.0);
}
static void cpu_KCCFLN05_action_resume(surf_action_t action)
{
- if(action->resource_type==(surf_resource_t)surf_network_resource)
- lmm_update_variable_weight(maxmin_system_network_KCCFLN05,
- ((surf_action_network_KCCFLN05_t) action)->variable, 1.0);
- else if(action->resource_type==(surf_resource_t)surf_cpu_resource)
- lmm_update_variable_weight(maxmin_system_cpu_KCCFLN05,
- ((surf_action_cpu_KCCFLN05_t) action)->variable, 1.0);
- else DIE_IMPOSSIBLE;
+ lmm_update_variable_weight(maxmin_system_cpu_KCCFLN05,
+ ((surf_action_cpu_KCCFLN05_t) action)->variable, 1.0);
}
static int cpu_KCCFLN05_action_is_suspended(surf_action_t action)
{
- if(action->resource_type==(surf_resource_t)surf_network_resource)
- return (lmm_get_variable_weight(((surf_action_cpu_KCCFLN05_t) action)->variable) == 0.0);
- if(action->resource_type==(surf_resource_t)surf_cpu_resource)
- return (lmm_get_variable_weight(((surf_action_network_KCCFLN05_t) action)->variable) == 0.0);
- DIE_IMPOSSIBLE;
+ return (lmm_get_variable_weight(((surf_action_cpu_KCCFLN05_t) action)->variable) == 0.0);
}
/************* workstation ************/
static void action_suspend(surf_action_t action)
{
- xbt_assert0(action->resource_type ==
- ((surf_resource_t) surf_cpu_resource),
- "Resource type mismatch");
- surf_cpu_resource->extension_public->suspend(action);
+ if(action->resource_type==(surf_resource_t)surf_network_resource)
+ surf_network_resource->common_public->suspend(action);
+ else if(action->resource_type==(surf_resource_t)surf_cpu_resource)
+ surf_cpu_resource->common_public->suspend(action);
+ else DIE_IMPOSSIBLE;
}
static void action_resume(surf_action_t action)
{
- xbt_assert0(action->resource_type ==
- ((surf_resource_t) surf_cpu_resource),
- "Resource type mismatch");
- surf_cpu_resource->extension_public->resume(action);
+ if(action->resource_type==(surf_resource_t)surf_network_resource)
+ surf_network_resource->common_public->resume(action);
+ else if(action->resource_type==(surf_resource_t)surf_cpu_resource)
+ surf_cpu_resource->common_public->resume(action);
+ else DIE_IMPOSSIBLE;
}
static int action_is_suspended(surf_action_t action)
{
if(action->resource_type==(surf_resource_t)surf_network_resource)
- return 0;
+ return surf_network_resource->common_public->is_suspended(action);
if(action->resource_type==(surf_resource_t)surf_cpu_resource)
- return surf_cpu_resource->extension_public->is_suspended(action);
+ return surf_cpu_resource->common_public->is_suspended(action);
DIE_IMPOSSIBLE;
}
-
/**************************************/
/********* Module creation ***********/
/**************************************/
surf_cpu_resource->extension_public->execute = execute_KCCFLN05;
/*FIXME*//* surf_cpu_resource->extension_public->sleep = action_sleep; */
- surf_cpu_resource->extension_public->suspend = cpu_KCCFLN05_action_suspend;
- surf_cpu_resource->extension_public->resume = cpu_KCCFLN05_action_resume;
- surf_cpu_resource->extension_public->is_suspended = cpu_KCCFLN05_action_is_suspended;
+
+ surf_cpu_resource->common_public->suspend = cpu_KCCFLN05_action_suspend;
+ surf_cpu_resource->common_public->resume = cpu_KCCFLN05_action_resume;
+ surf_cpu_resource->common_public->is_suspended = cpu_KCCFLN05_action_is_suspended;
surf_cpu_resource->extension_public->get_state = get_state;
update_network_KCCFLN05_state;
surf_network_resource->common_private->finalize = network_KCCFLN05_finalize;
- surf_network_resource->extension_public->communicate = communicate_KCCFLN05;
+ surf_network_resource->common_public->suspend = network_KCCFLN05_action_suspend;
+ surf_network_resource->common_public->resume = network_KCCFLN05_action_resume;
+ surf_network_resource->common_public->is_suspended = network_KCCFLN05_action_is_suspended;
+
+ surf_network_resource->extension_public->communicate = communicate_KCCFLN05;
network_link_set = xbt_dict_new();
surf_workstation_resource->common_private->update_resource_state = update_resource_state;
surf_workstation_resource->common_private->finalize = workstation_KCCFLN05_finalize;
+
+ surf_workstation_resource->common_public->suspend = action_suspend;
+ surf_workstation_resource->common_public->resume = action_resume;
+ surf_workstation_resource->common_public->is_suspended = action_is_suspended;
+
surf_workstation_resource->extension_public->execute = execute_KCCFLN05;
/*FIXME*//* surf_workstation_resource->extension_public->sleep = action_sleep; */
- surf_workstation_resource->extension_public->suspend = action_suspend;
- surf_workstation_resource->extension_public->resume = action_resume;
- surf_workstation_resource->extension_public->is_suspended = action_is_suspended;
surf_workstation_resource->extension_public->get_state = get_state;
surf_workstation_resource->extension_public->communicate = communicate_KCCFLN05;
}