X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/22b3e706eb926a52a50f895b3313e587a92ca0e5..46e0cb17f365814060eccbd32af103d1b41ae34b:/src/surf/surf_routing.c diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index cfd09c54e2..9f7d2ae3b3 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -105,22 +105,22 @@ static void parse_S_host(sg_platf_host_cbarg_t host) { network_element_info_t info = NULL; if (current_routing->hierarchy == SURF_ROUTING_NULL) current_routing->hierarchy = SURF_ROUTING_BASE; - xbt_assert(!xbt_lib_get_or_null(host_lib, host->V_host_id,ROUTING_HOST_LEVEL), + xbt_assert(!xbt_lib_get_or_null(host_lib, host->id,ROUTING_HOST_LEVEL), "Reading a host, processing unit \"%s\" already exists", - host->V_host_id); + host->id); xbt_assert(current_routing->set_processing_unit, "no defined method \"set_processing_unit\" in \"%s\"", current_routing->name); - (*(current_routing->set_processing_unit)) (current_routing, host->V_host_id); + (*(current_routing->set_processing_unit)) (current_routing, host->id); info = xbt_new0(s_network_element_info_t, 1); info->rc_component = current_routing; info->rc_type = SURF_NETWORK_ELEMENT_HOST; - xbt_lib_set(host_lib,host->V_host_id,ROUTING_HOST_LEVEL,(void *) info); - if (host->V_host_coord && strcmp(host->V_host_coord,"")) { + xbt_lib_set(host_lib,host->id,ROUTING_HOST_LEVEL,(void *) info); + if (host->coord && strcmp(host->coord,"")) { if(!COORD_HOST_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'"); - xbt_dynar_t ctn = xbt_str_split_str(host->V_host_coord, " "); + xbt_dynar_t ctn = xbt_str_split_str(host->coord, " "); xbt_dynar_shrink(ctn, 0); - xbt_lib_set(host_lib,host->V_host_id,COORD_HOST_LEVEL,(void *) ctn); + xbt_lib_set(host_lib,host->id,COORD_HOST_LEVEL,(void *) ctn); } } @@ -132,24 +132,23 @@ static void parse_S_router(sg_platf_router_cbarg_t router) network_element_info_t info = NULL; if (current_routing->hierarchy == SURF_ROUTING_NULL) current_routing->hierarchy = SURF_ROUTING_BASE; - xbt_assert(!xbt_lib_get_or_null(as_router_lib,router->V_router_id, ROUTING_ASR_LEVEL), + xbt_assert(!xbt_lib_get_or_null(as_router_lib,router->id, ROUTING_ASR_LEVEL), "Reading a router, processing unit \"%s\" already exists", - router->V_router_id); + router->id); xbt_assert(current_routing->set_processing_unit, "no defined method \"set_processing_unit\" in \"%s\"", current_routing->name); - (*(current_routing->set_processing_unit)) (current_routing, - router->V_router_id); + (*(current_routing->set_processing_unit)) (current_routing, router->id); info = xbt_new0(s_network_element_info_t, 1); info->rc_component = current_routing; info->rc_type = SURF_NETWORK_ELEMENT_ROUTER; - xbt_lib_set(as_router_lib,router->V_router_id,ROUTING_ASR_LEVEL,(void *) info); + xbt_lib_set(as_router_lib,router->id,ROUTING_ASR_LEVEL,(void *) info); if (strcmp(A_surfxml_router_coordinates,"")) { if(!COORD_ASR_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'"); xbt_dynar_t ctn = xbt_str_split_str(A_surfxml_router_coordinates, " "); xbt_dynar_shrink(ctn, 0); - xbt_lib_set(as_router_lib,router->V_router_id,COORD_ASR_LEVEL,(void *) ctn); + xbt_lib_set(as_router_lib,router->id,COORD_ASR_LEVEL,(void *) ctn); } } @@ -159,8 +158,8 @@ static void parse_S_router(sg_platf_router_cbarg_t router) static void parse_S_router_lua(const char* router_id) { s_sg_platf_router_cbarg_t router; memset(&router,0,sizeof(router)); - router.V_router_id = router_id; - router.V_router_coord = ""; + router.id = router_id; + router.coord = ""; return parse_S_router(&router); } @@ -1425,13 +1424,13 @@ void routing_parse_Scluster(void) link_id = bprintf("%s_link_%d", struct_cluster->V_cluster_id, start); XBT_DEBUG("", host_id, struct_cluster->S_cluster_power); - host.V_host_id = host_id; + host.id = host_id; if(strcmp(struct_cluster->V_cluster_availability_file,"")){ xbt_dict_set(patterns, "radical", bprintf("%d", start), xbt_free); char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file); xbt_str_varsubst(tmp_availability_file,patterns); XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file); - host.V_host_power_trace = tmgr_trace_new(tmp_availability_file); + host.power_trace = tmgr_trace_new(tmp_availability_file); xbt_free(tmp_availability_file); } else @@ -1442,7 +1441,7 @@ void routing_parse_Scluster(void) char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file); xbt_str_varsubst(tmp_state_file,patterns); XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file); - host.V_host_state_trace = tmgr_trace_new(tmp_state_file); + host.state_trace = tmgr_trace_new(tmp_state_file); xbt_free(tmp_state_file); } else @@ -1450,11 +1449,11 @@ void routing_parse_Scluster(void) XBT_DEBUG("\tstate_file=\"\""); } - host.V_host_power_peak = struct_cluster->S_cluster_power; - host.V_host_power_scale = 1.0; - host.V_host_core = struct_cluster->S_cluster_core; - host.V_host_state_initial = SURF_RESOURCE_ON; - host.V_host_coord = ""; + host.power_peak = struct_cluster->S_cluster_power; + host.power_scale = 1.0; + host.core_amount = struct_cluster->S_cluster_core; + host.initial_state = SURF_RESOURCE_ON; + host.coord = ""; sg_platf_new_host(&host); XBT_DEBUG(""); @@ -1468,24 +1467,20 @@ void routing_parse_Scluster(void) XBT_DEBUG("", link_id,struct_cluster->S_cluster_bw, struct_cluster->S_cluster_lat); memset(&link,0,sizeof(link)); - link.V_link_id = link_id; - link.V_link_bandwidth = struct_cluster->S_cluster_bw; - link.V_link_latency = struct_cluster->S_cluster_lat; - link.V_link_bandwidth_file = NULL; - link.V_link_latency_file = NULL; - link.V_link_state_file = NULL; - link.V_link_state = SURF_RESOURCE_ON; - link.V_link_sharing_policy = A_surfxml_link_sharing_policy; + link.id = link_id; + link.bandwidth = struct_cluster->S_cluster_bw; + link.latency = struct_cluster->S_cluster_lat; + link.state = SURF_RESOURCE_ON; switch (A_surfxml_link_sharing_policy) { case A_surfxml_link_sharing_policy_SHARED: - link.V_policy_initial_link = SURF_LINK_SHARED; + link.policy = SURF_LINK_SHARED; break; case A_surfxml_link_sharing_policy_FATPIPE: - link.V_policy_initial_link = SURF_LINK_FATPIPE; + link.policy = SURF_LINK_FATPIPE; break; case A_surfxml_link_sharing_policy_FULLDUPLEX: - link.V_policy_initial_link = SURF_LINK_FULLDUPLEX; + link.policy = SURF_LINK_FULLDUPLEX; break; case AU_surfxml_link_sharing_policy: surf_parse_error(bprintf("Invalid sharing policy in cluster %s (please report this bug, this shouldn't happen)",struct_cluster->V_cluster_id)); @@ -1523,13 +1518,13 @@ void routing_parse_Scluster(void) A_surfxml_host_state = A_surfxml_host_state_ON; XBT_DEBUG("", host_id, struct_cluster->S_cluster_power); - host.V_host_id = host_id; + host.id = host_id; if(strcmp(struct_cluster->V_cluster_availability_file,"")){ xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free); char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file); xbt_str_varsubst(tmp_availability_file,patterns); XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file); - host.V_host_power_trace = tmgr_trace_new(tmp_availability_file); + host.power_trace = tmgr_trace_new(tmp_availability_file); xbt_free(tmp_availability_file); } else @@ -1540,7 +1535,7 @@ void routing_parse_Scluster(void) char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file); xbt_str_varsubst(tmp_state_file,patterns); XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file); - host.V_host_state_trace = tmgr_trace_new(tmp_state_file); + host.state_trace = tmgr_trace_new(tmp_state_file); xbt_free(tmp_state_file); } else @@ -1548,11 +1543,11 @@ void routing_parse_Scluster(void) XBT_DEBUG("\tstate_file=\"\""); } - host.V_host_power_peak = struct_cluster->S_cluster_power; - host.V_host_power_scale = 1.0; - host.V_host_core = struct_cluster->S_cluster_core; - host.V_host_state_initial = SURF_RESOURCE_ON; - host.V_host_coord = ""; + host.power_peak = struct_cluster->S_cluster_power; + host.power_scale = 1.0; + host.core_amount = struct_cluster->S_cluster_core; + host.initial_state = SURF_RESOURCE_ON; + host.coord = ""; sg_platf_new_host(&host); XBT_DEBUG(""); @@ -1565,30 +1560,30 @@ void routing_parse_Scluster(void) XBT_DEBUG("", link_id,struct_cluster->S_cluster_bw, struct_cluster->S_cluster_lat); memset(&link,0,sizeof(link)); - link.V_link_id = link_id; - link.V_link_bandwidth = struct_cluster->S_cluster_bw; - link.V_link_latency = struct_cluster->S_cluster_lat; - link.V_link_bandwidth_file = NULL; - link.V_link_latency_file = NULL; - link.V_link_state_file = NULL; - link.V_link_state = SURF_RESOURCE_ON; - link.V_link_sharing_policy = A_surfxml_link_sharing_policy; - - if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED) - link.V_policy_initial_link = SURF_LINK_SHARED; - else - { - if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FATPIPE) - link.V_policy_initial_link = SURF_LINK_FATPIPE; - else if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX) - link.V_policy_initial_link = SURF_LINK_FULLDUPLEX; + link.id = link_id; + link.bandwidth = struct_cluster->S_cluster_bw; + link.latency = struct_cluster->S_cluster_lat; + link.state = SURF_RESOURCE_ON; + + switch (struct_cluster->V_cluster_sharing_policy) { + case A_surfxml_cluster_sharing_policy_SHARED: + link.policy = SURF_LINK_SHARED; + break; + case A_surfxml_cluster_sharing_policy_FULLDUPLEX: + link.policy = SURF_LINK_FULLDUPLEX; + break; + case A_surfxml_cluster_sharing_policy_FATPIPE: + link.policy = SURF_LINK_FATPIPE; + break; + default: + surf_parse_error(bprintf("Invalid cluster sharing policy for cluster %s",struct_cluster->V_cluster_id)); } sg_platf_new_link(&link); ETag_surfxml_link(); surf_parsing_link_up_down_t info = xbt_new0(s_surf_parsing_link_up_down_t, 1); - if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_FULLDUPLEX){ + if (link.policy == SURF_LINK_FULLDUPLEX) { char* tmp_link = bprintf("%s_UP",link_id); info->link_up = xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL); free(tmp_link); @@ -1629,24 +1624,22 @@ void routing_parse_Scluster(void) char *link_backbone = bprintf("%s_backbone", struct_cluster->V_cluster_id); XBT_DEBUG("", link_backbone,struct_cluster->S_cluster_bb_bw, struct_cluster->S_cluster_bb_lat); - A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED; - if(AX_surfxml_cluster_bb_sharing_policy == A_surfxml_cluster_bb_sharing_policy_FATPIPE) - {A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;} - memset(&link,0,sizeof(link)); - link.V_link_id = link_backbone; - link.V_link_bandwidth = struct_cluster->S_cluster_bb_bw; - link.V_link_latency = struct_cluster->S_cluster_bb_lat; - link.V_link_bandwidth_file = NULL; - link.V_link_latency_file = NULL; - link.V_link_state_file = NULL; - link.V_link_state = SURF_RESOURCE_ON; - link.V_link_sharing_policy = A_surfxml_link_sharing_policy; - - if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED) - link.V_policy_initial_link = SURF_LINK_SHARED; - else - link.V_policy_initial_link = SURF_LINK_FATPIPE; + link.id = link_backbone; + link.bandwidth = struct_cluster->S_cluster_bb_bw; + link.latency = struct_cluster->S_cluster_bb_lat; + link.state = SURF_RESOURCE_ON; + + switch (AX_surfxml_cluster_bb_sharing_policy) { + case A_surfxml_cluster_bb_sharing_policy_FATPIPE: + link.policy = SURF_LINK_FATPIPE; + break; + case A_surfxml_cluster_bb_sharing_policy_SHARED: + link.policy = SURF_LINK_SHARED; + break; + default: + surf_parse_error(bprintf("Invalid bb sharing policy in cluster %s",struct_cluster->V_cluster_id)); + } sg_platf_new_link(&link); ETag_surfxml_link();