From d528b1c80ec6456af1cd0ddff758a5ad2230d322 Mon Sep 17 00:00:00 2001 From: navarrop Date: Thu, 13 Jan 2011 14:14:06 +0000 Subject: [PATCH] Now tag config is available. See teshsuite/simdag/platfroms/properties.xml for use it. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9407 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/include/surf/surf.h | 1 + src/simdag/sd_global.c | 6 ++-- src/simix/smx_environment.c | 4 +++ src/surf/surf_routing.c | 24 ++++++++------- src/surf/surfxml_parse.c | 22 ++++++++------ .../simdag/platforms/basic_parsing_test.tesh | 8 +++++ teshsuite/simdag/platforms/properties.xml | 30 +++++++++++++++++++ teshsuite/simdag/platforms/two_clusters.xml | 5 ---- .../platforms/two_clusters_symmetric.xml | 8 +---- 9 files changed, 74 insertions(+), 34 deletions(-) create mode 100644 teshsuite/simdag/platforms/properties.xml diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index af144b6828..00b33d3f54 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -620,6 +620,7 @@ XBT_PUBLIC(void) surf_init(int *argc, char **argv); /* initialize common str * its code between, say, MSG_init and MSG_create_environment using MSG_config */ XBT_PUBLIC(void) surf_config_models_setup(const char *platform_file); +XBT_PUBLIC(void) surf_config_add_callback(void); /** \brief create the elements of the models * diff --git a/src/simdag/sd_global.c b/src/simdag/sd_global.c index 01c3a62661..14066967fb 100644 --- a/src/simdag/sd_global.c +++ b/src/simdag/sd_global.c @@ -170,10 +170,12 @@ void SD_create_environment(const char *platform_file) void *surf_workstation = NULL; void *surf_link = NULL; - SD_CHECK_INIT_DONE(); + //First pass of platform file + surf_config_add_callback(); + parse_platform_file(platform_file); + SD_CHECK_INIT_DONE(); DEBUG0("SD_create_environment"); - surf_config_models_setup(platform_file); parse_platform_file(platform_file); surf_config_models_create_elms(); diff --git a/src/simix/smx_environment.c b/src/simix/smx_environment.c index 6621fe95b5..8f60fcc24a 100644 --- a/src/simix/smx_environment.c +++ b/src/simix/smx_environment.c @@ -38,6 +38,10 @@ void SIMIX_create_environment(const char *file) double start, end; + //First pass of platform file + surf_config_add_callback(); + parse_platform_file(file); + surf_config_models_setup(file); parse_platform_file(file); surf_config_models_create_elms(); diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 0c874c8866..632b140541 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -1053,7 +1053,6 @@ static e_surf_network_element_type_t get_network_element_type(const char */ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_t get_link_latency_fun) { - /* config the uniq global routing */ global_routing = xbt_new0(s_routing_global_t, 1); global_routing->where_network_elements = xbt_dict_new(); @@ -1104,16 +1103,19 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_ surfxml_add_callback(STag_surfxml_peer_cb_list, &routing_parse_Speer); - surfxml_add_callback(STag_surfxml_config_cb_list, - &routing_parse_Sconfig); - surfxml_add_callback(ETag_surfxml_config_cb_list, - &routing_parse_Econfig); - #ifdef HAVE_TRACING instr_routing_define_callbacks(); #endif } +void surf_config_add_callback(void) +{ + surf_parse_reset_parser(); + surfxml_add_callback(STag_surfxml_config_cb_list, &routing_parse_Sconfig); + surfxml_add_callback(ETag_surfxml_config_cb_list, &routing_parse_Econfig); + surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties); +} + /* ************************************************************************** */ /* *************************** FULL ROUTING ********************************* */ @@ -3243,20 +3245,20 @@ static void generic_src_dst_check(routing_component_t rc, const char *src, static void routing_parse_Sconfig(void) { - //TODO - DEBUG0("WARNING tag config not yet implemented."); - DEBUG1("Configuration name = %s",A_surfxml_config_id); + DEBUG1("START configuration name = %s",A_surfxml_config_id); } static void routing_parse_Econfig(void) { - //TODO xbt_dict_cursor_t cursor = NULL; char *key; char *elem; + char *cfg; xbt_dict_foreach(current_property_set, cursor, key, elem) { - DEBUG2("property : %s = %s",key,elem); + cfg = bprintf("%s:%s",key,elem); + xbt_cfg_set_parse(_surf_cfg_set, cfg); } + DEBUG1("End configuration name = %s",A_surfxml_config_id); } static void routing_parse_Scluster(void) diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index d9280a4830..749bfa235a 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -207,8 +207,10 @@ void surf_parse_reset_parser(void) xbt_dynar_new(sizeof(void_f_void_t), NULL); ETag_surfxml_peer_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); - STag_surfxml_config_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); - ETag_surfxml_config_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); + STag_surfxml_config_cb_list = + xbt_dynar_new(sizeof(void_f_void_t), NULL); + ETag_surfxml_config_cb_list = + xbt_dynar_new(sizeof(void_f_void_t), NULL); } /* Stag and Etag parse functions */ @@ -387,13 +389,16 @@ static void init_data(void) trace_connect_list_bandwidth = xbt_dict_new(); trace_connect_list_latency = xbt_dict_new(); - surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness); - surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness); surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties); - surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_Stag_trace); - surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace); - surfxml_add_callback(STag_surfxml_trace_connect_cb_list, - &parse_Stag_trace_connect); + if(xbt_dynar_is_empty(STag_surfxml_config_cb_list)) + { + surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness); + surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness); + surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_Stag_trace); + surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace); + surfxml_add_callback(STag_surfxml_trace_connect_cb_list, + &parse_Stag_trace_connect); + } } static void free_data(void) @@ -409,7 +414,6 @@ static void free_data(void) } /* Here start parse */ - void parse_platform_file(const char *file) { int parse_status; diff --git a/teshsuite/simdag/platforms/basic_parsing_test.tesh b/teshsuite/simdag/platforms/basic_parsing_test.tesh index 18efe5bee0..d4ee225784 100644 --- a/teshsuite/simdag/platforms/basic_parsing_test.tesh +++ b/teshsuite/simdag/platforms/basic_parsing_test.tesh @@ -73,3 +73,11 @@ $ ${bindir:=.}/basic_parsing_test ./four_hosts_floyd.xml $ ${bindir:=.}/basic_parsing_test ./four_hosts_floyd_bis.xml > [0.000000] [surf_workstation/INFO] surf_workstation_model_init_ptask_L07 > Workstation number: 5, link number: 7 + +$ ${bindir:=.}/basic_parsing_test ./properties.xml +> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '0.000010' +> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'cpu/model' to 'CpuTI' +> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'workstation/model' to 'compound' +> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'Vegas' +> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'path' to '~/' +> Workstation number: 1, link number: 1 \ No newline at end of file diff --git a/teshsuite/simdag/platforms/properties.xml b/teshsuite/simdag/platforms/properties.xml new file mode 100644 index 0000000000..3e197c10e6 --- /dev/null +++ b/teshsuite/simdag/platforms/properties.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/teshsuite/simdag/platforms/two_clusters.xml b/teshsuite/simdag/platforms/two_clusters.xml index e55fa1651a..24c82b7849 100644 --- a/teshsuite/simdag/platforms/two_clusters.xml +++ b/teshsuite/simdag/platforms/two_clusters.xml @@ -1,11 +1,6 @@ - - - - - diff --git a/teshsuite/simdag/platforms/two_clusters_symmetric.xml b/teshsuite/simdag/platforms/two_clusters_symmetric.xml index e9a0ab2f4c..667d228143 100644 --- a/teshsuite/simdag/platforms/two_clusters_symmetric.xml +++ b/teshsuite/simdag/platforms/two_clusters_symmetric.xml @@ -1,12 +1,6 @@ - - - - - - - +