Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Now tag config is available.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 13 Jan 2011 14:14:06 +0000 (14:14 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 13 Jan 2011 14:14:06 +0000 (14:14 +0000)
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
src/simdag/sd_global.c
src/simix/smx_environment.c
src/surf/surf_routing.c
src/surf/surfxml_parse.c
teshsuite/simdag/platforms/basic_parsing_test.tesh
teshsuite/simdag/platforms/properties.xml [new file with mode: 0644]
teshsuite/simdag/platforms/two_clusters.xml
teshsuite/simdag/platforms/two_clusters_symmetric.xml

index af144b6..00b33d3 100644 (file)
@@ -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
  *
index 01c3a62..1406696 100644 (file)
@@ -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();
index 6621fe9..8f60fcc 100644 (file)
@@ -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();
index 0c874c8..632b140 100644 (file)
@@ -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)
index d9280a4..749bfa2 100644 (file)
@@ -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;
index 18efe5b..d4ee225 100644 (file)
@@ -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 (file)
index 0000000..3e197c1
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="3">
+       
+<config id="General">
+       <prop id="maxmin/precision" value="0.000010"></prop>
+
+       <prop id="cpu/model" value="Cas01_fullupdate"></prop>
+       <prop id="cpu/model" value="Cas01"></prop>
+       <prop id="cpu/model" value="CpuTI"></prop>
+       
+       <prop id="workstation/model" value="CLM03"></prop>
+       <prop id="workstation/model" value="ptask_L07"></prop>
+       <prop id="workstation/model" value="compound"></prop>
+       
+       <prop id="network/model" value="Constant"></prop>
+       <prop id="network/model" value="CM02"></prop>
+       <prop id="network/model" value="LV08"></prop>
+       <prop id="network/model" value="SMPI"></prop>
+       <prop id="network/model" value="Reno"></prop>
+       <prop id="network/model" value="Reno2"></prop>
+       <prop id="network/model" value="Vegas"></prop>
+       
+       <prop id="path" value="~/"></prop>
+</config>
+       
+<AS  id="AS0"  routing="Full">
+       <host id="bob" power="500000000"/>
+</AS>
+</platform>
index e55fa16..24c82b7 100644 (file)
@@ -1,11 +1,6 @@
 <?xml version='1.0'?>
  <!DOCTYPE platform SYSTEM "simgrid.dtd">
  <platform version="3">
- <config id="general">
-       <prop id="test" value="retest"></prop>
-       <prop id="test" value="retest"></prop>
-       <prop id="test" value="retest"></prop>
- </config>
        
  <AS  id="AS0"  routing="Full">
        
index e9a0ab2..667d228 100644 (file)
@@ -1,12 +1,6 @@
 <?xml version='1.0'?>
  <!DOCTYPE platform SYSTEM "simgrid.dtd">
- <platform version="3">
- <config id="general">
-       <prop id="test" value="retest"></prop>
-       <prop id="test" value="retest"></prop>
-       <prop id="test" value="retest"></prop>
- </config>
-       
+ <platform version="3">        
  <AS  id="AS0"  routing="Full">
        
      <cluster id="bob_cluster" prefix="bob" suffix=".hamburger.edu"