From 5e2dd3ecf166c2d82974beb220aeb8dd4200f105 Mon Sep 17 00:00:00 2001 From: navarrop Date: Tue, 28 Sep 2010 08:52:26 +0000 Subject: [PATCH] I comment all the calls to used_routing, in order to use global routing. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8231 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/include/surf/surf.h | 8 +++- src/instr/variables_instr.c | 16 +++++--- src/surf/network.c | 25 ++++++++++-- src/surf/network_gtnets.c | 70 +++++++++++++++++++++----------- src/surf/network_private.h | 4 ++ src/surf/simgrid.dtd | 19 ++++++++- src/surf/surf_private.h | 22 +++++----- src/surf/surf_routing.c | 9 ++-- src/surf/workstation.c | 5 ++- src/surf/workstation_ptask_L07.c | 27 ++++++------ 10 files changed, 137 insertions(+), 68 deletions(-) diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 402c0b305f..c7a07c97f6 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -128,8 +128,12 @@ XBT_PUBLIC(void) model_help(const char* category, s_surf_model_description_t * t /***************************/ /* Generic model object */ /***************************/ - typedef struct s_routing s_routing_t, *routing_t; -XBT_PUBLIC_DATA(routing_t) used_routing; +// typedef struct s_routing s_routing_t, *routing_t; // COMMENT BY DAVID +//XBT_PUBLIC_DATA(routing_t) used_routing; // COMMENT BY DAVID + + typedef struct s_routing_global s_routing_global_t, *routing_global_t; // ADDED BY DAVID +XBT_PUBLIC_DATA(routing_global_t) global_routing; // ADDED BY DAVID + /** \brief Private data available on all models * \ingroup SURF_models diff --git a/src/instr/variables_instr.c b/src/instr/variables_instr.c index 6c1d84c25a..bc51c874a8 100644 --- a/src/instr/variables_instr.c +++ b/src/instr/variables_instr.c @@ -10,7 +10,8 @@ #ifdef HAVE_TRACING -extern routing_t used_routing; +// extern routing_t used_routing; // COMMENTED BY DAVID +extern routing_global_t global_routing; void __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what) { @@ -29,12 +30,15 @@ void __TRACE_link_variable (double time, const char *src, const char *dst, const return; } - if (!used_routing) return; - - src_id = *(int*)xbt_dict_get(used_routing->host_id,src); - dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst); - route = used_routing->get_route(src_id, dst_id); +// if (!used_routing) return; +// +// src_id = *(int*)xbt_dict_get(used_routing->host_id,src); +// dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst); +// route = used_routing->get_route(src_id, dst_id); + if (!global_routing) return; + route = global_routing->get_route(src, dst); + xbt_dynar_foreach(route, i, link_ptr) { link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name; diff --git a/src/surf/network.c b/src/surf/network.c index 7a3c23a152..88232f08be 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -324,6 +324,17 @@ static void net_update_actions_state(double now, double delta) */ xbt_swag_foreach_safe(action, next_action, running_actions) { +#ifdef HAVE_TRACING +// COMMENTED BY DAVID +// xbt_dynar_t route = used_routing->get_route(action->src, action->dst); +// +// link_CM02_t link; +// unsigned int i; +// xbt_dynar_foreach(route, i, link) { +// TRACE_surf_link_set_utilization (link->lmm_resource.generic_resource.name, +// action->generic_action.data, lmm_variable_getvalue(action->variable), now-delta, delta); +// } +#endif deltap = delta; if (action->latency > 0) { if (action->latency > deltap) { @@ -483,14 +494,17 @@ static surf_action_t net_communicate(const char *src_name, const char *dst_name, /* LARGE PLATFORMS HACK: Add a link_CM02_t *link and a int link_nb to network_card_CM02_t. It will represent local links for this node Use the cluster_id for ->id */ - xbt_dynar_t route = used_routing->get_route(src, dst); + + //xbt_dynar_t route = used_routing->get_route(src, dst); // COMMENTED BY DAVID + xbt_dynar_t route = global_routing->get_route(src_name, dst_name); xbt_dynar_t back_route = NULL; int constraints_per_variable = 0; if( sg_network_fullduplex == 1){ - back_route = used_routing->get_route(dst, src); + //back_route = used_routing->get_route(dst, src); // COMMENTED BY DAVID + back_route = global_routing->get_route(src_name, dst_name); } - + /* LARGE PLATFORMS HACK: total_route_size = route_size + src->link_nb + dst->nb */ @@ -636,7 +650,10 @@ static void net_finalize(void) surf_model_exit(surf_network_model); surf_network_model = NULL; - used_routing->finalize(); + //used_routing->finalize(); // COMMENTED BY DAVID + + global_routing->finalize(); + lmm_system_free(network_maxmin_system); network_maxmin_system = NULL; } diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index a1a88476ff..6580578dcd 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -13,7 +13,9 @@ static double time_to_next_flow_completion = -1; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets, surf, "Logging specific to the SURF network GTNetS module"); -extern routing_t used_routing; +//extern routing_t used_routing; // COMMENTED BY DAVID +extern routing_global_t global_routing; // ADDED BY DAVID + double sg_gtnets_jitter=0.0; int sg_gtnets_jitter_seed=10; @@ -133,29 +135,31 @@ static void create_gtnets_topology() xbt_dict_cursor_t cursor = NULL; char *key, *data; - xbt_dict_t onelink_routes = used_routing->get_onelink_routes(); - xbt_assert0(onelink_routes, "Error onelink_routes was not initialized"); - - DEBUG0("Starting topology generation"); - - xbt_dict_foreach(onelink_routes, cursor, key, data){ - s_onelink_t link = (s_onelink_t) data; - - DEBUG3("Link (#%d), src (#%d), dst (#%d)", ((network_link_GTNETS_t)(link->link_ptr))->id , link->src_id, link->dst_id); - DEBUG0("Calling one link route"); - if(used_routing->is_router(link->src_id)){ - gtnets_add_router(link->src_id); - } - if(used_routing->is_router(link->dst_id)){ - gtnets_add_router(link->dst_id); - } - route_onehop_new(link->src_id, link->dst_id, (network_link_GTNETS_t)(link->link_ptr)); - } +// COMMENTED BY DAVID +// xbt_dict_t onelink_routes = used_routing->get_onelink_routes(); +// xbt_assert0(onelink_routes, "Error onelink_routes was not initialized"); +// +// DEBUG0("Starting topology generation"); +// +// xbt_dict_foreach(onelink_routes, cursor, key, data){ +// s_onelink_t link = (s_onelink_t) data; +// +// DEBUG3("Link (#%d), src (#%d), dst (#%d)", ((network_link_GTNETS_t)(link->link_ptr))->id , link->src_id, link->dst_id); +// DEBUG0("Calling one link route"); +// if(used_routing->is_router(link->src_id)){ +// gtnets_add_router(link->src_id); +// } +// if(used_routing->is_router(link->dst_id)){ +// gtnets_add_router(link->dst_id); +// } +// route_onehop_new(link->src_id, link->dst_id, (network_link_GTNETS_t)(link->link_ptr)); +// } +// +// xbt_dict_free(&route_table); +// if (XBT_LOG_ISENABLED(surf_network_gtnets, xbt_log_priority_debug)) { +// gtnets_print_topology(); +// } - xbt_dict_free(&route_table); - if (XBT_LOG_ISENABLED(surf_network_gtnets, xbt_log_priority_debug)) { - gtnets_print_topology(); - } } /* Main XML parsing */ @@ -261,6 +265,7 @@ static void update_actions_state(double now, double delta) trace_sent = action->generic_action.cost; } // tracing resource utilization +<<<<<<< HEAD int src = TRACE_surf_gtnets_get_src (action); int dst = TRACE_surf_gtnets_get_dst (action); if (src != -1 && dst != -1){ @@ -272,6 +277,22 @@ static void update_actions_state(double now, double delta) action->generic_action.data, trace_sent/delta, now-delta, delta); } } +======= + +// COMMENTED BY DAVID +// int src = TRACE_surf_gtnets_get_src (action); +// int dst = TRACE_surf_gtnets_get_dst (action); +// if (src != -1 && dst != -1){ +// xbt_dynar_t route = used_routing->get_route(src, dst); +// network_link_GTNETS_t link; +// unsigned int i; +// xbt_dynar_foreach(route, i, link) { +// +// TRACE_surf_link_set_utilization (link->generic_resource.name, +// action->generic_action.data, (action->generic_action.remains-remain)/delta, now-delta, delta); +// } +// } +>>>>>>> I comment all the calls to used_routing, in order to use global routing. #endif DEBUG1("Sent value returned by GTNetS : %f", sent); @@ -323,7 +344,8 @@ static surf_action_t communicate(const char *src_name, const char *dst_name, DEBUG4("Setting flow src %d \"%s\", dst %d \"%s\"", src, src_name, dst, dst_name); - xbt_dynar_t links = used_routing->get_route(src, dst); + //xbt_dynar_t links = used_routing->get_route(src, dst); // COMMENTED BY DAVID + xbt_dynar_t links = global_routing->get_route(src_name, dst_name); // ADDED BY DAVID route_new(src, dst, links, xbt_dynar_length(links)); action = surf_action_new(sizeof(s_surf_action_network_GTNETS_t), size, surf_network_model, 0); diff --git a/src/surf/network_private.h b/src/surf/network_private.h index db5364e5c6..56237db710 100644 --- a/src/surf/network_private.h +++ b/src/surf/network_private.h @@ -32,6 +32,10 @@ typedef struct surf_action_network_CM02 { int src; /* saving source id for tracing */ int dst; /* saving dest id for tracing */ + + char* src_name; /* saving source id for tracing */ // ADDED BY DAVID + char* dst_name; /* saving dest id for tracing */ // ADDED BY DAVID + } s_surf_action_network_CM02_t, *surf_action_network_CM02_t; #endif /* _SURF_NETWORK_PRIVATE_H */ diff --git a/src/surf/simgrid.dtd b/src/surf/simgrid.dtd index 7074c55afa..ab5fb0afbb 100644 --- a/src/surf/simgrid.dtd +++ b/src/surf/simgrid.dtd @@ -106,12 +106,27 @@ - + + + + + + + + + + + + + +