From: mquinson Date: Sat, 27 Oct 2007 11:31:47 +0000 (+0000) Subject: Check that the platform file does not define the same element (host or link) twice... X-Git-Tag: v3.3~896 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/62be96c324e33952038493a0aef1bb4a518766c3?hp=412030f2d029818ada64567bd92cbc3d0ec0d634 Check that the platform file does not define the same element (host or link) twice. Fail otherwise. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4906 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/surf/cpu.c b/src/surf/cpu.c index c14f6cc36c..75b84d589b 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -29,7 +29,9 @@ static cpu_Cas01_t cpu_new(char *name, double power_scale, xbt_dict_t cpu_properties) { cpu_Cas01_t cpu = xbt_new0(s_cpu_Cas01_t, 1); - + xbt_assert1(!xbt_dict_get_or_null(cpu_set, name), + "Host '%s' declared several times in the platform file",name); + cpu->model = (surf_model_t) surf_cpu_model; cpu->name = name; cpu->power_scale = power_scale; diff --git a/src/surf/network.c b/src/surf/network.c index 531dbbbe58..77615d7332 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -37,18 +37,19 @@ static void link_free(void *nw_link) } static link_CM02_t link_new(char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_link_state_t - state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t - policy, xbt_dict_t properties) + double bw_initial, + tmgr_trace_t bw_trace, + double lat_initial, + tmgr_trace_t lat_trace, + e_surf_link_state_t + state_initial, + tmgr_trace_t state_trace, + e_surf_link_sharing_policy_t + 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), + "Link '%s' declared several times in the platform file.", name); nw_link->model = (surf_model_t) surf_network_model; nw_link->name = name; diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index ea7a8107a3..361e9d79d7 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -11,20 +11,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets, surf, "Logging specific to the SURF network module"); -/* surf_network_model_t surf_network_model = NULL; */ -/*static xbt_dict_t link_set = NULL;*/ - -/* xbt_dict_t network_card_set = NULL; */ - -#if 0 -static int card_number = 0; -static link_GTNETS_t **routing_table = NULL; -static int *routing_table_size = NULL; - -#define ROUTE(i,j) routing_table[(i)+(j)*card_number] -#define ROUTE_SIZE(i,j) routing_table_size[(i)+(j)*card_number] -#endif - /** QUESTIONS for GTNetS integration ** 1. Check that we did the right thing with name_service and get_resource_name ** 2. Right now there is no "kill flow" in our GTNetS implementation. Do we @@ -51,7 +37,7 @@ static void link_new(char *name, double bw, double lat, xbt_dict_t props) static int link_count = -1; link_GTNETS_t gtnets_link; - /* KF: Check that the link wasn't added before */ + /* If link already exists, nothing to do (FIXME: check that multiple definition match?) */ if (xbt_dict_get_or_null(link_set, name)) { return; } diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index d839e25b74..0698fede72 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -10,8 +10,8 @@ #include "xbt/dict.h" #include "surf/surfxml_parse_private.h" #include "surf/surf_private.h" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(parse, surf, - "Logging specific to the SURF module"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, + "Logging specific to the SURF parsing module"); #undef CLEANUP #include "surfxml.c" diff --git a/src/surf/workstation_KCCFLN05.c b/src/surf/workstation_KCCFLN05.c index fc56baf326..9dcb5ae8cd 100644 --- a/src/surf/workstation_KCCFLN05.c +++ b/src/surf/workstation_KCCFLN05.c @@ -11,6 +11,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf, "Logging specific to the SURF workstation module (KCCFLN05)"); +XBT_LOG_EXTERNAL_CATEGORY(surf_parse); typedef enum { SURF_WORKSTATION_RESOURCE_CPU, @@ -909,7 +910,12 @@ static cpu_KCCFLN05_t cpu_new(const char *name, double power_scale, xbt_dict_t cpu_properties_k) { cpu_KCCFLN05_t cpu = xbt_new0(s_cpu_KCCFLN05_t, 1); + xbt_assert1(! xbt_dict_get_or_null(workstation_set, name), + "Host '%s' declared several times in the platform file.",name); + CDEBUG8(surf_parse, "cpu_new(%s,power_scale=%.2f,power_initial=%.2f,state_init=%d,isend=%.2f,irecv=%.2f,isendrev=%.2f) -> %p", + name,power_scale,power_initial,state_initial,interference_send,interference_recv,interference_send_recv,cpu); + cpu->model = (surf_model_t) surf_workstation_model; cpu->type = SURF_WORKSTATION_RESOURCE_CPU; cpu->name = xbt_strdup(name); @@ -1191,6 +1197,8 @@ static void parse_file(const char *file) { int i; + CDEBUG0(surf_parse, "Use the KCCFKN05 model"); + /* Adding callback functions */ surf_parse_reset_parser(); surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init); diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index 1a21049e2f..2e7fa61dea 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -684,6 +684,8 @@ static cpu_L07_t cpu_new(const char *name, double power_scale, xbt_dict_t cpu_properties) { cpu_L07_t cpu = xbt_new0(s_cpu_L07_t, 1); + xbt_assert1(! xbt_dict_get_or_null(workstation_set, name), + "Host '%s' declared several times in the platform file.",name); cpu->model = (surf_model_t) surf_workstation_model; cpu->type = SURF_WORKSTATION_RESOURCE_CPU; @@ -752,18 +754,19 @@ static void link_free(void *nw_link) } static link_L07_t link_new(char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_link_state_t - state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t - policy, xbt_dict_t properties) -{ + double bw_initial, + tmgr_trace_t bw_trace, + double lat_initial, + tmgr_trace_t lat_trace, + e_surf_link_state_t + state_initial, + tmgr_trace_t state_trace, + e_surf_link_sharing_policy_t + 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), + "Link '%s' declared several times in the platform file.",name); nw_link->model = (surf_model_t) surf_workstation_model; nw_link->type = SURF_WORKSTATION_RESOURCE_LINK;