Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Check that the platform file does not define the same element (host or link) twice...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 27 Oct 2007 11:31:47 +0000 (11:31 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sat, 27 Oct 2007 11:31:47 +0000 (11:31 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4906 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/cpu.c
src/surf/network.c
src/surf/network_gtnets.c
src/surf/surfxml_parse.c
src/surf/workstation_KCCFLN05.c
src/surf/workstation_ptask_L07.c

index c14f6cc..75b84d5 100644 (file)
@@ -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;
index 531dbbb..77615d7 100644 (file)
@@ -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;
index ea7a810..361e9d7 100644 (file)
 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;
   }
index d839e25..0698fed 100644 (file)
@@ -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"
index fc56baf..9dcb5ae 100644 (file)
@@ -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);
index 1a21049..2e7fa61 100644 (file)
@@ -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;