git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6434
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
Allows to implement other ways of storing that info)
=> kill now useless network_card concept
- Use dynar to represent routes (instead of void** + int*)
Allows to implement other ways of storing that info)
=> kill now useless network_card concept
- Use dynar to represent routes (instead of void** + int*)
+ - kill link_set (use surf_network_model->resource_set instead)
* Simplify model declaration
(less redirections, less function to write when defining a model)
* Simplify model declaration
(less redirections, less function to write when defining a model)
XBT_PUBLIC_DATA(s_surf_model_description_t)
surf_workstation_model_description[];
XBT_PUBLIC_DATA(s_surf_model_description_t)
surf_workstation_model_description[];
-/** \brief The network links
- * \ingroup SURF_models
- *
- * This dict contains all network links.
- *
- * \see workstation_set
- */
-XBT_PUBLIC_DATA(xbt_dict_t) link_set;
-
-/** \brief The workstations
- * \ingroup SURF_models
- *
- * This dict contains all workstations.
- *
- * \see link_set
- */
/** \brief List of initialized models
* \ingroup SURF_models
*/
/** \brief List of initialized models
* \ingroup SURF_models
*/
__SD_workstation_create(surf_workstation, NULL);
}
__SD_workstation_create(surf_workstation, NULL);
}
- xbt_dict_foreach(link_set, cursor, name, surf_link) {
+ xbt_dict_foreach(surf_model_resource_set(surf_network_model), cursor, name, surf_link) {
__SD_link_create(surf_link, NULL);
}
__SD_link_create(surf_link, NULL);
}
typedef struct cpu_Cas01 {
s_surf_resource_t generic_resource;
typedef struct cpu_Cas01 {
s_surf_resource_t generic_resource;
double power_scale;
double power_current;
tmgr_trace_event_t power_event;
double power_scale;
double power_current;
tmgr_trace_event_t power_event;
surf_action_cpu_Cas01_t action = NULL;
cpu_Cas01_t CPU = cpu;
surf_action_cpu_Cas01_t action = NULL;
cpu_Cas01_t CPU = cpu;
- XBT_IN2("(%s,%g)", CPU->name, size);
+ XBT_IN2("(%s,%g)", CPU->generic_resource.name, size);
action = xbt_new0(s_surf_action_cpu_Cas01_t, 1);
action->generic_action.refcount = 1;
action = xbt_new0(s_surf_action_cpu_Cas01_t, 1);
action->generic_action.refcount = 1;
if (duration > 0)
duration = MAX(duration, MAXMIN_PRECISION);
if (duration > 0)
duration = MAX(duration, MAXMIN_PRECISION);
- XBT_IN2("(%s,%g)", ((cpu_Cas01_t) cpu)->name, duration);
+ XBT_IN2("(%s,%g)", ((cpu_Cas01_t) cpu)->generic_resource.name, duration);
action = (surf_action_cpu_Cas01_t) execute(cpu, 1.0);
action->generic_action.max_duration = duration;
action->suspended = 2;
action = (surf_action_cpu_Cas01_t) execute(cpu, 1.0);
action->generic_action.max_duration = duration;
action->suspended = 2;
surf_model_t surf_network_model = NULL;
static lmm_system_t network_maxmin_system = NULL;
static void (*network_solve) (lmm_system_t) = NULL;
surf_model_t surf_network_model = NULL;
static lmm_system_t network_maxmin_system = NULL;
static void (*network_solve) (lmm_system_t) = NULL;
-xbt_dict_t link_set = NULL;
double latency_factor = 1.0; /* default value */
double bandwidth_factor = 1.0; /* default value */
double latency_factor = 1.0; /* default value */
double bandwidth_factor = 1.0; /* default value */
policy, xbt_dict_t properties)
{
link_CM02_t nw_link = xbt_new0(s_link_CM02_t, 1);
policy, xbt_dict_t properties)
{
link_CM02_t nw_link = xbt_new0(s_link_CM02_t, 1);
- xbt_assert1(!xbt_dict_get_or_null(link_set, name),
+ xbt_assert1(!xbt_dict_get_or_null(surf_network_model->resource_set, name),
"Link '%s' declared several times in the platform file.", name);
nw_link->generic_resource.model = surf_network_model;
"Link '%s' declared several times in the platform file.", name);
nw_link->generic_resource.model = surf_network_model;
current_property_set = properties;
current_property_set = properties;
- xbt_dict_set(link_set, name, nw_link, link_free);
+ xbt_dict_set(surf_network_model->resource_set, name, nw_link, link_free);
/* connect all traces relative to network */
xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
/* connect all traces relative to network */
xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
+ link_CM02_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
trace_name, elm);
xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
trace_name, elm);
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
+ link_CM02_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
trace_name, elm);
xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
trace_name, elm);
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
+ link_CM02_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
trace_name, elm);
xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
trace_name, elm);
static void finalize(void)
{
static void finalize(void)
{
- xbt_dict_free(&link_set);
-
surf_model_exit(surf_network_model);
surf_network_model = NULL;
surf_model_exit(surf_network_model);
surf_network_model = NULL;
static void surf_network_model_init_internal(void)
{
static void surf_network_model_init_internal(void)
{
- link_set = xbt_dict_new();
surf_network_model = surf_model_init();
surf_network_model->name = "network";
surf_network_model = surf_model_init();
surf_network_model->name = "network";
network_link_GTNETS_t gtnets_link;
/* If link already exists, nothing to do (FIXME: check that multiple definition match?) */
network_link_GTNETS_t gtnets_link;
/* If link already exists, nothing to do (FIXME: check that multiple definition match?) */
- if (xbt_dict_get_or_null(link_set, name)) {
+ if (xbt_dict_get_or_null(surf_network_model->resource_set, name)) {
/* Add the properties */
gtnets_link->properties = props;
/* Add the properties */
gtnets_link->properties = props;
- xbt_dict_set(link_set, name, gtnets_link, link_free);
+ xbt_dict_set(surf_network_model->resource_set, name, gtnets_link, link_free);
xbt_dynar_foreach(links, cpt, link) {
TRY {
xbt_dynar_foreach(links, cpt, link) {
TRY {
- link_list[nb_link++] = xbt_dict_get(link_set, link);
+ link_list[nb_link++] = xbt_dict_get(surf_network_model->resource_set, link);
}
CATCH(e) {
RETHROW1("Link %s not found (dict raised this exception: %s)", link);
}
CATCH(e) {
RETHROW1("Link %s not found (dict raised this exception: %s)", link);
xbt_dynar_foreach(links, cpt, link) {
TRY {
xbt_dynar_foreach(links, cpt, link) {
TRY {
- link_list[nb_link++] = xbt_dict_get(link_set, link);
+ link_list[nb_link++] = xbt_dict_get(surf_network_model->resource_set, link);
}
CATCH(e) {
RETHROW1("Link %s not found (dict raised this exception: %s)", link);
}
CATCH(e) {
RETHROW1("Link %s not found (dict raised this exception: %s)", link);
static void finalize(void)
{
static void finalize(void)
{
- xbt_dict_free(&link_set);
+ xbt_dict_free(&surf_network_model->resource_set);
surf_model_exit(surf_network_model);
surf_model_exit(surf_network_model);
/*for the props of the link */
surf_network_model->get_properties = get_properties;
/*for the props of the link */
surf_network_model->get_properties = get_properties;
- link_set = xbt_dict_new();
-
/* KF: Added the initialization for GTNetS interface */
if (gtnets_initialize()) {
xbt_assert0(0, "impossible to initialize GTNetS interface");
/* KF: Added the initialization for GTNetS interface */
if (gtnets_initialize()) {
xbt_assert0(0, "impossible to initialize GTNetS interface");
DEBUG4("Handle %d %d (from %d hosts): %ld links",
src_id,dst_id,routing->generic_routing.host_count,xbt_dynar_length(links));
xbt_dynar_foreach(links, cpt, link_name) {
DEBUG4("Handle %d %d (from %d hosts): %ld links",
src_id,dst_id,routing->generic_routing.host_count,xbt_dynar_length(links));
xbt_dynar_foreach(links, cpt, link_name) {
- void* link = xbt_dict_get_or_null(link_set, link_name);
+ void* link = xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
if (link)
xbt_dynar_push(ROUTE_FULL(src_id,dst_id),&link);
else
if (link)
xbt_dynar_push(ROUTE_FULL(src_id,dst_id),&link);
else
static void finalize(void)
{
static void finalize(void)
{
- xbt_dict_free(&link_set);
- if (parallel_task_link_set != NULL) {
+ if (parallel_task_link_set != NULL)
xbt_dict_free(¶llel_task_link_set);
xbt_dict_free(¶llel_task_link_set);
surf_model_exit(surf_workstation_model);
surf_workstation_model = NULL;
surf_model_exit(surf_workstation_model);
surf_workstation_model = NULL;
+ surf_model_exit(surf_network_model);
+ surf_network_model = NULL;
used_routing->finalize();
host_count = 0; // FIXME: KILLME?
used_routing->finalize();
host_count = 0; // FIXME: KILLME?
policy, xbt_dict_t properties)
{
link_L07_t nw_link = xbt_new0(s_link_L07_t, 1);
policy, xbt_dict_t properties)
{
link_L07_t nw_link = xbt_new0(s_link_L07_t, 1);
- xbt_assert1(!xbt_dict_get_or_null(link_set, name),
+ xbt_assert1(!xbt_dict_get_or_null(surf_network_model->resource_set, name),
"Link '%s' declared several times in the platform file.", name);
nw_link->generic_resource.model = surf_workstation_model;
"Link '%s' declared several times in the platform file.", name);
nw_link->generic_resource.model = surf_workstation_model;
nw_link->properties = properties;
nw_link->properties = properties;
- xbt_dict_set(link_set, name, nw_link, link_free);
+ xbt_dict_set(surf_network_model->resource_set, name, nw_link, link_free);
/* Connect traces relative to network */
xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
/* Connect traces relative to network */
xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_L07_t link = xbt_dict_get_or_null(link_set, elm);
+ link_L07_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_L07_t link = xbt_dict_get_or_null(link_set, elm);
+ link_L07_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_L07_t link = xbt_dict_get_or_null(link_set, elm);
+ link_L07_t link = xbt_dict_get_or_null(surf_network_model->resource_set, elm);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
xbt_assert1(link, "Link %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
surf_workstation_model->get_properties = get_properties;
surf_workstation_model->get_properties = get_properties;
- link_set = xbt_dict_new();
-
if (!ptask_maxmin_system)
ptask_maxmin_system = lmm_system_new();
if (!ptask_maxmin_system)
ptask_maxmin_system = lmm_system_new();
{
xbt_assert0(!surf_cpu_model, "CPU model type already defined");
xbt_assert0(!surf_network_model, "network model type already defined");
{
xbt_assert0(!surf_cpu_model, "CPU model type already defined");
xbt_assert0(!surf_network_model, "network model type already defined");
+ surf_network_model = surf_model_init();
define_callbacks(filename);
model_init_internal();
define_callbacks(filename);
model_init_internal();