A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[java] Sync code generation with generated source code
[simgrid.git]
/
src
/
surf
/
surf_routing.cpp
diff --git
a/src/surf/surf_routing.cpp
b/src/surf/surf_routing.cpp
index
dbde952
..
a80a7f6
100644
(file)
--- a/
src/surf/surf_routing.cpp
+++ b/
src/surf/surf_routing.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2009-2011, 2013-201
4
. The SimGrid Team.
+/* Copyright (c) 2009-2011, 2013-201
5
. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
@@
-110,7
+110,7
@@
struct s_model_type routing_models[] = {
/**
* \brief Add a "host_link" to the network element list
*/
/**
* \brief Add a "host_link" to the network element list
*/
-static void parse_S_host
_link
(sg_platf_host_link_cbarg_t host)
+static void parse_S_host(sg_platf_host_link_cbarg_t host)
{
RoutingEdge *info = sg_host_edge(sg_host_by_name(host->id));
xbt_assert(info, "Host '%s' not found!", host->id);
{
RoutingEdge *info = sg_host_edge(sg_host_by_name(host->id));
xbt_assert(info, "Host '%s' not found!", host->id);
@@
-140,8
+140,11
@@
static void parse_S_host_link(sg_platf_host_link_cbarg_t host)
/**
* \brief Add a "host" to the network element list
*/
/**
* \brief Add a "host" to the network element list
*/
-
static void parse_S_hos
t(sg_platf_host_cbarg_t host)
+
void routing_parse_ini
t(sg_platf_host_cbarg_t host)
{
{
+ if (! current_routing)
+ return;
+
if (current_routing->p_hierarchy == SURF_ROUTING_NULL)
current_routing->p_hierarchy = SURF_ROUTING_BASE;
xbt_assert(!sg_host_by_name(host->id),
if (current_routing->p_hierarchy == SURF_ROUTING_NULL)
current_routing->p_hierarchy = SURF_ROUTING_BASE;
xbt_assert(!sg_host_by_name(host->id),
@@
-518,7
+521,7
@@
static void elements_father(sg_routing_edge_t src, sg_routing_edge_t dst,
static void _get_route_and_latency(RoutingEdge *src, RoutingEdge *dst,
xbt_dynar_t * links, double *latency)
{
static void _get_route_and_latency(RoutingEdge *src, RoutingEdge *dst,
xbt_dynar_t * links, double *latency)
{
- s_sg_platf_route_cbarg_t route;
+ s_sg_platf_route_cbarg_t route
= SG_PLATF_ROUTE_INITIALIZER
;
memset(&route,0,sizeof(route));
xbt_assert(src && dst, "bad parameters for \"_get_route_latency\" method");
memset(&route,0,sizeof(route));
xbt_assert(src && dst, "bad parameters for \"_get_route_latency\" method");
@@
-717,8
+720,8
@@
void routing_model_create( void *loopback)
void routing_cluster_add_backbone(void* bb) {
xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER],
"You have to be in model Cluster to use tag backbone!");
void routing_cluster_add_backbone(void* bb) {
xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER],
"You have to be in model Cluster to use tag backbone!");
- xbt_assert(!s
urf_as_cluster_get_backbone(current_routing)
, "The backbone link is already defined!");
- s
urf_as_cluster_set_backbone(current_routing,
bb);
+ xbt_assert(!s
tatic_cast<AsCluster*>(current_routing)->p_backbone
, "The backbone link is already defined!");
+ s
tatic_cast<AsCluster*>(current_routing)->p_backbone = static_cast<Link*>(
bb);
XBT_DEBUG("Add a backbone to AS '%s'", current_routing->p_name);
}
XBT_DEBUG("Add a backbone to AS '%s'", current_routing->p_name);
}
@@
-748,21
+751,21
@@
static void routing_parse_cabinet(sg_platf_cabinet_cbarg_t cabinet)
surf_parse_error("Malformed radical");
break;
}
surf_parse_error("Malformed radical");
break;
}
- s_sg_platf_host_cbarg_t host;
+ s_sg_platf_host_cbarg_t host
= SG_PLATF_HOST_INITIALIZER
;
memset(&host, 0, sizeof(host));
host.initial_state = SURF_RESOURCE_ON;
host.pstate = 0;
host.power_scale = 1.0;
host.core_amount = 1;
memset(&host, 0, sizeof(host));
host.initial_state = SURF_RESOURCE_ON;
host.pstate = 0;
host.power_scale = 1.0;
host.core_amount = 1;
- s_sg_platf_link_cbarg_t link;
+ s_sg_platf_link_cbarg_t link
= SG_PLATF_LINK_INITIALIZER
;
memset(&link, 0, sizeof(link));
link.state = SURF_RESOURCE_ON;
link.policy = SURF_LINK_FULLDUPLEX;
link.latency = cabinet->lat;
link.bandwidth = cabinet->bw;
memset(&link, 0, sizeof(link));
link.state = SURF_RESOURCE_ON;
link.policy = SURF_LINK_FULLDUPLEX;
link.latency = cabinet->lat;
link.bandwidth = cabinet->bw;
- s_sg_platf_host_link_cbarg_t host_link;
+ s_sg_platf_host_link_cbarg_t host_link
= SG_PLATF_HOST_LINK_INITIALIZER
;
memset(&host_link, 0, sizeof(host_link));
for (i = start; i <= end; i++) {
memset(&host_link, 0, sizeof(host_link));
for (i = start; i <= end; i++) {
@@
-770,10
+773,10
@@
static void routing_parse_cabinet(sg_platf_cabinet_cbarg_t cabinet)
link_id = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix);
host.id = host_id;
link.id = link_id;
link_id = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix);
host.id = host_id;
link.id = link_id;
- xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL);
- xbt_dynar_push(power_state_list,&cabinet->power);
- host.power_peak = power_state_list;
+ host.power_peak = xbt_dynar_new(sizeof(double), NULL);
+ xbt_dynar_push(host.power_peak,&cabinet->power);
sg_platf_new_host(&host);
sg_platf_new_host(&host);
+ xbt_dynar_free(&host.power_peak);
sg_platf_new_link(&link);
char* link_up = bprintf("%s_UP",link_id);
sg_platf_new_link(&link);
char* link_up = bprintf("%s_UP",link_id);
@@
-800,8
+803,8
@@
static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
xbt_dict_t patterns = NULL;
int rankId=0;
xbt_dict_t patterns = NULL;
int rankId=0;
- s_sg_platf_host_cbarg_t host;
- s_sg_platf_link_cbarg_t link;
+ s_sg_platf_host_cbarg_t host
= SG_PLATF_HOST_INITIALIZER
;
+ s_sg_platf_link_cbarg_t link
= SG_PLATF_LINK_INITIALIZER
;
unsigned int iter;
int start, end, i;
unsigned int iter;
int start, end, i;
@@
-912,9
+915,8
@@
static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
XBT_DEBUG("\tstate_file=\"\"");
}
XBT_DEBUG("\tstate_file=\"\"");
}
- xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL);
- xbt_dynar_push(power_state_list,&cluster->power);
- host.power_peak = power_state_list;
+ host.power_peak = xbt_dynar_new(sizeof(double), NULL);
+ xbt_dynar_push(host.power_peak,&cluster->power);
host.pstate = 0;
//host.power_peak = cluster->power;
host.pstate = 0;
//host.power_peak = cluster->power;
@@
-923,6
+925,7
@@
static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
host.initial_state = SURF_RESOURCE_ON;
host.coord = "";
sg_platf_new_host(&host);
host.initial_state = SURF_RESOURCE_ON;
host.coord = "";
sg_platf_new_host(&host);
+ xbt_dynar_free(&host.power_peak);
XBT_DEBUG("</host>");
XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_id,
XBT_DEBUG("</host>");
XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_id,
@@
-1009,7
+1012,7
@@
static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
XBT_DEBUG(" ");
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id);
char *newid = NULL;
XBT_DEBUG(" ");
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id);
char *newid = NULL;
- s_sg_platf_router_cbarg_t router;
+ s_sg_platf_router_cbarg_t router
= SG_PLATF_ROUTER_INITIALIZER
;
memset(&router, 0, sizeof(router));
router.id = cluster->router_id;
router.coord = "";
memset(&router, 0, sizeof(router));
router.id = cluster->router_id;
router.coord = "";
@@
-1071,14
+1074,13
@@
static void routing_parse_peer(sg_platf_peer_cbarg_t peer)
current_routing->p_linkUpDownList = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL);
XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\"/>", host_id, peer->power);
current_routing->p_linkUpDownList = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL);
XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\"/>", host_id, peer->power);
- s_sg_platf_host_cbarg_t host;
+ s_sg_platf_host_cbarg_t host
= SG_PLATF_HOST_INITIALIZER
;
memset(&host, 0, sizeof(host));
host.initial_state = SURF_RESOURCE_ON;
host.id = host_id;
memset(&host, 0, sizeof(host));
host.initial_state = SURF_RESOURCE_ON;
host.id = host_id;
- xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL);
- xbt_dynar_push(power_state_list,&peer->power);
- host.power_peak = power_state_list;
+ host.power_peak = xbt_dynar_new(sizeof(double), NULL);
+ xbt_dynar_push(host.power_peak,&peer->power);
host.pstate = 0;
//host.power_peak = peer->power;
host.power_scale = 1.0;
host.pstate = 0;
//host.power_peak = peer->power;
host.power_scale = 1.0;
@@
-1086,8
+1088,9
@@
static void routing_parse_peer(sg_platf_peer_cbarg_t peer)
host.state_trace = peer->state_trace;
host.core_amount = 1;
sg_platf_new_host(&host);
host.state_trace = peer->state_trace;
host.core_amount = 1;
sg_platf_new_host(&host);
+ xbt_dynar_free(&host.power_peak);
- s_sg_platf_link_cbarg_t link;
+ s_sg_platf_link_cbarg_t link
= SG_PLATF_LINK_INITIALIZER
;
memset(&link, 0, sizeof(link));
link.state = SURF_RESOURCE_ON;
link.policy = SURF_LINK_SHARED;
memset(&link, 0, sizeof(link));
link.state = SURF_RESOURCE_ON;
link.policy = SURF_LINK_SHARED;
@@
-1108,7
+1111,7
@@
static void routing_parse_peer(sg_platf_peer_cbarg_t peer)
sg_platf_new_link(&link);
XBT_DEBUG("<host_link\tid=\"%s\"\tup=\"%s\"\tdown=\"%s\" />", host_id,link_up,link_down);
sg_platf_new_link(&link);
XBT_DEBUG("<host_link\tid=\"%s\"\tup=\"%s\"\tdown=\"%s\" />", host_id,link_up,link_down);
- s_sg_platf_host_link_cbarg_t host_link;
+ s_sg_platf_host_link_cbarg_t host_link
= SG_PLATF_HOST_LINK_INITIALIZER
;
memset(&host_link, 0, sizeof(host_link));
host_link.id = host_id;
host_link.link_up = link_up;
memset(&host_link, 0, sizeof(host_link));
host_link.id = host_id;
host_link.link_up = link_up;
@@
-1116,7
+1119,7
@@
static void routing_parse_peer(sg_platf_peer_cbarg_t peer)
sg_platf_new_host_link(&host_link);
XBT_DEBUG("<router id=\"%s\"/>", router_id);
sg_platf_new_host_link(&host_link);
XBT_DEBUG("<router id=\"%s\"/>", router_id);
- s_sg_platf_router_cbarg_t router;
+ s_sg_platf_router_cbarg_t router
= SG_PLATF_ROUTER_INITIALIZER
;
memset(&router, 0, sizeof(router));
router.id = router_id;
router.coord = peer->coord;
memset(&router, 0, sizeof(router));
router.id = router_id;
router.coord = peer->coord;
@@
-1273,9
+1276,8
@@
static void check_disk_attachment()
void routing_register_callbacks()
{
void routing_register_callbacks()
{
- sg_platf_host_add_cb(parse_S_host);
sg_platf_router_add_cb(parse_S_router);
sg_platf_router_add_cb(parse_S_router);
- sg_platf_host_link_add_cb(parse_S_host
_link
);
+ sg_platf_host_link_add_cb(parse_S_host);
sg_platf_route_add_cb(parse_E_route);
sg_platf_ASroute_add_cb(parse_E_ASroute);
sg_platf_bypassRoute_add_cb(parse_E_bypassRoute);
sg_platf_route_add_cb(parse_E_route);
sg_platf_ASroute_add_cb(parse_E_ASroute);
sg_platf_bypassRoute_add_cb(parse_E_bypassRoute);