From dec88cb5450df90eb490d9bf0655184904981438 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Thu, 7 Mar 2013 10:49:23 +0100 Subject: [PATCH] add a loopback_lat and loopback_bw to cluster tag --- include/simgrid/platf.h | 2 ++ include/surf/simgrid_dtd.h | 10 ++++++++++ src/include/surf/surfxml_parse_values.h | 1 + src/surf/simgrid.dtd | 2 ++ src/surf/surf_routing.c | 19 +++++++++++++++++++ src/surf/surf_routing_cluster.c | 11 +++++++++++ src/surf/surf_routing_private.h | 1 + src/surf/surfxml_parse.c | 4 ++++ 8 files changed, 50 insertions(+) diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index 29e76064e5..652b8bc9ce 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -187,6 +187,8 @@ typedef struct s_sg_platf_cluster_cbarg { double lat; double bb_bw; double bb_lat; + double loopback_bw; + double loopback_lat; double limiter_link; const char* router_id; e_surf_link_sharing_policy_t sharing_policy; diff --git a/include/surf/simgrid_dtd.h b/include/surf/simgrid_dtd.h index 930d5bb4e1..f619d0502c 100644 --- a/include/surf/simgrid_dtd.h +++ b/include/surf/simgrid_dtd.h @@ -179,6 +179,8 @@ typedef int AT_surfxml_cluster_bb___bw; typedef int AT_surfxml_argument_value; #define AU_surfxml_argument_value NULL typedef enum { AU_surfxml_link_state, A_surfxml_link_state_ON,A_surfxml_link_state_OFF } AT_surfxml_link_state; +typedef int AT_surfxml_cluster_loopback___bw; +#define AU_surfxml_cluster_loopback___bw NULL typedef int AT_surfxml_ASroute_gw___src; #define AU_surfxml_ASroute_gw___src NULL typedef enum { AU_surfxml_AS_routing, A_surfxml_AS_routing_Full,A_surfxml_AS_routing_Floyd,A_surfxml_AS_routing_Dijkstra,A_surfxml_AS_routing_DijkstraCache,A_surfxml_AS_routing_None,A_surfxml_AS_routing_RuleBased,A_surfxml_AS_routing_Vivaldi,A_surfxml_AS_routing_Cluster } AT_surfxml_AS_routing; @@ -263,6 +265,8 @@ typedef int AT_surfxml_peer_id; #define AU_surfxml_peer_id NULL typedef int AT_surfxml_cluster_router___id; #define AU_surfxml_cluster_router___id NULL +typedef int AT_surfxml_cluster_loopback___lat; +#define AU_surfxml_cluster_loopback___lat NULL typedef int AT_surfxml_cabinet_radical; #define AU_surfxml_cabinet_radical NULL typedef enum { AU_surfxml_cluster_sharing___policy, A_surfxml_cluster_sharing___policy_SHARED,A_surfxml_cluster_sharing___policy_FULLDUPLEX,A_surfxml_cluster_sharing___policy_FATPIPE } AT_surfxml_cluster_sharing___policy; @@ -439,6 +443,9 @@ XBT_PUBLIC_DATA(short int) surfxml_argument_value_isset; XBT_PUBLIC_DATA(AT_surfxml_link_state) AX_surfxml_link_state; #define A_surfxml_link_state AX_surfxml_link_state XBT_PUBLIC_DATA(short int) surfxml_link_state_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_loopback___bw) AX_surfxml_cluster_loopback___bw; +#define A_surfxml_cluster_loopback___bw (surfxml_bufferstack + AX_surfxml_cluster_loopback___bw) +XBT_PUBLIC_DATA(short int) surfxml_cluster_loopback___bw_isset; XBT_PUBLIC_DATA(AT_surfxml_ASroute_gw___src) AX_surfxml_ASroute_gw___src; #define A_surfxml_ASroute_gw___src (surfxml_bufferstack + AX_surfxml_ASroute_gw___src) XBT_PUBLIC_DATA(short int) surfxml_ASroute_gw___src_isset; @@ -571,6 +578,9 @@ XBT_PUBLIC_DATA(short int) surfxml_peer_id_isset; XBT_PUBLIC_DATA(AT_surfxml_cluster_router___id) AX_surfxml_cluster_router___id; #define A_surfxml_cluster_router___id (surfxml_bufferstack + AX_surfxml_cluster_router___id) XBT_PUBLIC_DATA(short int) surfxml_cluster_router___id_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_loopback___lat) AX_surfxml_cluster_loopback___lat; +#define A_surfxml_cluster_loopback___lat (surfxml_bufferstack + AX_surfxml_cluster_loopback___lat) +XBT_PUBLIC_DATA(short int) surfxml_cluster_loopback___lat_isset; XBT_PUBLIC_DATA(AT_surfxml_cabinet_radical) AX_surfxml_cabinet_radical; #define A_surfxml_cabinet_radical (surfxml_bufferstack + AX_surfxml_cabinet_radical) XBT_PUBLIC_DATA(short int) surfxml_cabinet_radical_isset; diff --git a/src/include/surf/surfxml_parse_values.h b/src/include/surf/surfxml_parse_values.h index 389b67c7c9..ab31a170f8 100644 --- a/src/include/surf/surfxml_parse_values.h +++ b/src/include/surf/surfxml_parse_values.h @@ -13,6 +13,7 @@ typedef struct s_surf_parsing_link_up_down { void* link_up; void* link_down; void* limiter_link; + void* loopback_link; } s_surf_parsing_link_up_down_t; #endif /* SURFXML_PARSE_VALUES_H_ */ diff --git a/src/surf/simgrid.dtd b/src/surf/simgrid.dtd index 067e4a4e1d..ed8b8eb6e4 100644 --- a/src/surf/simgrid.dtd +++ b/src/surf/simgrid.dtd @@ -83,6 +83,8 @@ + + diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 32de839336..5901fbd2ff 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -918,6 +918,25 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster) info.limiter_link =NULL; } + if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){ + char *tmp_link = bprintf("%s_loopback", link_id); + XBT_DEBUG("", tmp_link, + cluster->limiter_link); + + + memset(&link, 0, sizeof(link)); + link.id = tmp_link; + link.bandwidth = cluster->loopback_bw; + link.latency = cluster->loopback_lat; + link.state = SURF_RESOURCE_ON; + link.policy = SURF_LINK_FATPIPE; + sg_platf_new_link(&link); + info.loopback_link = + xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL); + free(tmp_link); + }else{ + info.loopback_link =NULL; + } xbt_dynar_push(current_routing->link_up_down_list,&info); xbt_free(link_id); diff --git a/src/surf/surf_routing_cluster.c b/src/surf/surf_routing_cluster.c index a3308dad16..fbd7b4211d 100644 --- a/src/surf/surf_routing_cluster.c +++ b/src/surf/surf_routing_cluster.c @@ -30,6 +30,17 @@ static void cluster_get_route_and_latency(AS_t as, info = xbt_dynar_get_as(as->link_up_down_list, src->id, s_surf_parsing_link_up_down_t); + + if((src->id == dst->id) && info.loopback_link ){ + xbt_dynar_push_as(route->link_list, void *, info.loopback_link); + if (lat) + *lat += + surf_network_model->extension.network.get_link_latency(info. + loopback_link); + return; + } + + if (info.limiter_link) // limiter for sender xbt_dynar_push_as(route->link_list, void *, info.limiter_link); diff --git a/src/surf/surf_routing_private.h b/src/surf/surf_routing_private.h index c1369d03d9..b63fb23a9c 100644 --- a/src/surf/surf_routing_private.h +++ b/src/surf/surf_routing_private.h @@ -72,6 +72,7 @@ AS_t model_rulebased_create(void); /* create structures for rulebased routi typedef struct { s_as_t generic_routing; void *backbone; + void *loopback; sg_routing_edge_t router; } s_as_cluster_t, *as_cluster_t; diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 64d6f7fc41..fb6e217633 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -350,6 +350,10 @@ void STag_surfxml_cluster(void){ cluster.bb_lat = surf_parse_get_double(A_surfxml_cluster_bb___lat); if(strcmp(A_surfxml_cluster_limiter___link,"")) cluster.limiter_link = surf_parse_get_double(A_surfxml_cluster_limiter___link); + if(strcmp(A_surfxml_cluster_loopback___bw,"")) + cluster.loopback_bw = surf_parse_get_double(A_surfxml_cluster_loopback___bw); + if(strcmp(A_surfxml_cluster_loopback___lat,"")) + cluster.loopback_lat = surf_parse_get_double(A_surfxml_cluster_loopback___lat); cluster.router_id = A_surfxml_cluster_router___id; switch (AX_surfxml_cluster_sharing___policy) { -- 2.20.1