Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I comment all the calls to used_routing, in order to use global routing.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 28 Sep 2010 08:52:26 +0000 (08:52 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 28 Sep 2010 08:52:26 +0000 (08:52 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8231 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/surf/surf.h
src/instr/variables_instr.c
src/surf/network.c
src/surf/network_gtnets.c
src/surf/network_private.h
src/surf/simgrid.dtd
src/surf/surf_private.h
src/surf/surf_routing.c
src/surf/workstation.c
src/surf/workstation_ptask_L07.c

index 402c0b3..c7a07c9 100644 (file)
@@ -128,8 +128,12 @@ XBT_PUBLIC(void) model_help(const char* category, s_surf_model_description_t * t
 /***************************/
 /* Generic model object */
 /***************************/
-     typedef struct s_routing s_routing_t, *routing_t;
-XBT_PUBLIC_DATA(routing_t) used_routing;
+//     typedef struct s_routing s_routing_t, *routing_t; // COMMENT BY DAVID
+//XBT_PUBLIC_DATA(routing_t) used_routing; // COMMENT BY DAVID
+
+     typedef struct s_routing_global s_routing_global_t, *routing_global_t; // ADDED BY DAVID
+XBT_PUBLIC_DATA(routing_global_t) global_routing; // ADDED BY DAVID
+
 
 /** \brief Private data available on all models
  *  \ingroup SURF_models
index 6c1d84c..bc51c87 100644 (file)
@@ -10,7 +10,8 @@
 
 #ifdef HAVE_TRACING
 
-extern routing_t used_routing;
+// extern routing_t used_routing; // COMMENTED BY DAVID
+extern routing_global_t global_routing;
 
 void __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what)
 {
@@ -29,12 +30,15 @@ void __TRACE_link_variable (double time, const char *src, const char *dst, const
        return;
   }
 
-  if (!used_routing) return;
-
-  src_id = *(int*)xbt_dict_get(used_routing->host_id,src);
-  dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst);
-  route = used_routing->get_route(src_id, dst_id);
+//   if (!used_routing) return;
+// 
+//   src_id = *(int*)xbt_dict_get(used_routing->host_id,src);
+//   dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst);
+//   route = used_routing->get_route(src_id, dst_id);
 
+  if (!global_routing) return;
+  route = global_routing->get_route(src, dst);
+  
   xbt_dynar_foreach(route, i, link_ptr) {
        link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name;
 
index 7a3c23a..88232f0 100644 (file)
@@ -324,6 +324,17 @@ static void net_update_actions_state(double now, double delta)
    */
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
+#ifdef HAVE_TRACING
+// COMMENTED BY DAVID
+//     xbt_dynar_t route = used_routing->get_route(action->src, action->dst);
+//     
+//     link_CM02_t link;
+//     unsigned int i;
+//     xbt_dynar_foreach(route, i, link) {
+//             TRACE_surf_link_set_utilization (link->lmm_resource.generic_resource.name,
+//           action->generic_action.data, lmm_variable_getvalue(action->variable), now-delta, delta);
+//     }
+#endif
     deltap = delta;
     if (action->latency > 0) {
       if (action->latency > deltap) {
@@ -483,14 +494,17 @@ static surf_action_t net_communicate(const char *src_name, const char *dst_name,
   /* LARGE PLATFORMS HACK:
      Add a link_CM02_t *link and a int link_nb to network_card_CM02_t. It will represent local links for this node
      Use the cluster_id for ->id */
-  xbt_dynar_t route = used_routing->get_route(src, dst);
+
+  //xbt_dynar_t route = used_routing->get_route(src, dst);  // COMMENTED BY DAVID
+  xbt_dynar_t route = global_routing->get_route(src_name, dst_name);
   xbt_dynar_t back_route = NULL;
   int constraints_per_variable = 0;
 
   if( sg_network_fullduplex == 1){
-         back_route = used_routing->get_route(dst, src);
+         //back_route = used_routing->get_route(dst, src);  // COMMENTED BY DAVID
+         back_route = global_routing->get_route(src_name, dst_name);
   }
-
+  
   /* LARGE PLATFORMS HACK:
      total_route_size = route_size + src->link_nb + dst->nb */
 
@@ -636,7 +650,10 @@ static void net_finalize(void)
   surf_model_exit(surf_network_model);
   surf_network_model = NULL;
 
-  used_routing->finalize();
+  //used_routing->finalize(); // COMMENTED BY DAVID
+  
+  global_routing->finalize();
+  
   lmm_system_free(network_maxmin_system);
   network_maxmin_system = NULL;
 }
index a1a8847..6580578 100644 (file)
@@ -13,7 +13,9 @@ static double time_to_next_flow_completion = -1;
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets, surf,
                                 "Logging specific to the SURF network GTNetS module");
 
-extern routing_t used_routing;
+//extern routing_t used_routing; // COMMENTED BY DAVID
+extern routing_global_t global_routing; // ADDED BY DAVID
+
 double sg_gtnets_jitter=0.0;
 int sg_gtnets_jitter_seed=10;
 
@@ -133,29 +135,31 @@ static void create_gtnets_topology()
   xbt_dict_cursor_t cursor = NULL;
   char *key, *data;
 
-  xbt_dict_t onelink_routes = used_routing->get_onelink_routes();
-  xbt_assert0(onelink_routes, "Error onelink_routes was not initialized");
-
-  DEBUG0("Starting topology generation");
-
-  xbt_dict_foreach(onelink_routes, cursor, key, data){
-       s_onelink_t link = (s_onelink_t) data;
-
-       DEBUG3("Link (#%d), src (#%d), dst (#%d)", ((network_link_GTNETS_t)(link->link_ptr))->id , link->src_id, link->dst_id);
-    DEBUG0("Calling one link route");
-    if(used_routing->is_router(link->src_id)){
-       gtnets_add_router(link->src_id);
-    }
-    if(used_routing->is_router(link->dst_id)){
-       gtnets_add_router(link->dst_id);
-    }
-    route_onehop_new(link->src_id, link->dst_id, (network_link_GTNETS_t)(link->link_ptr));
-  }
+// COMMENTED BY DAVID
+//   xbt_dict_t onelink_routes = used_routing->get_onelink_routes();
+//   xbt_assert0(onelink_routes, "Error onelink_routes was not initialized");
+// 
+//   DEBUG0("Starting topology generation");
+// 
+//   xbt_dict_foreach(onelink_routes, cursor, key, data){
+//     s_onelink_t link = (s_onelink_t) data;
+// 
+//     DEBUG3("Link (#%d), src (#%d), dst (#%d)", ((network_link_GTNETS_t)(link->link_ptr))->id , link->src_id, link->dst_id);
+//     DEBUG0("Calling one link route");
+//     if(used_routing->is_router(link->src_id)){
+//             gtnets_add_router(link->src_id);
+//     }
+//     if(used_routing->is_router(link->dst_id)){
+//             gtnets_add_router(link->dst_id);
+//     }
+//     route_onehop_new(link->src_id, link->dst_id, (network_link_GTNETS_t)(link->link_ptr));
+//   }
+// 
+//   xbt_dict_free(&route_table);
+//   if (XBT_LOG_ISENABLED(surf_network_gtnets, xbt_log_priority_debug)) {
+//       gtnets_print_topology();
+//   }
 
-  xbt_dict_free(&route_table);
-  if (XBT_LOG_ISENABLED(surf_network_gtnets, xbt_log_priority_debug)) {
-         gtnets_print_topology();
-  }
 }
 
 /* Main XML parsing */
@@ -261,6 +265,7 @@ static void update_actions_state(double now, double delta)
         trace_sent = action->generic_action.cost;
       }
       // tracing resource utilization
+<<<<<<< HEAD
       int src = TRACE_surf_gtnets_get_src (action);
       int dst = TRACE_surf_gtnets_get_dst (action);
       if (src != -1 && dst != -1){
@@ -272,6 +277,22 @@ static void update_actions_state(double now, double delta)
             action->generic_action.data, trace_sent/delta, now-delta, delta);
         }
       }
+=======
+      
+// COMMENTED BY DAVID
+//       int src = TRACE_surf_gtnets_get_src (action);
+//       int dst = TRACE_surf_gtnets_get_dst (action);
+//       if (src != -1 && dst != -1){
+//         xbt_dynar_t route = used_routing->get_route(src, dst);
+//         network_link_GTNETS_t link;
+//         unsigned int i;
+//         xbt_dynar_foreach(route, i, link) {
+// 
+//             TRACE_surf_link_set_utilization (link->generic_resource.name,
+//             action->generic_action.data, (action->generic_action.remains-remain)/delta, now-delta, delta);
+//         }
+//       }
+>>>>>>> I comment all the calls to used_routing, in order to use global routing.
 #endif
 
       DEBUG1("Sent value returned by GTNetS : %f", sent);
@@ -323,7 +344,8 @@ static surf_action_t communicate(const char *src_name, const char *dst_name,
 
   DEBUG4("Setting flow src %d \"%s\", dst %d \"%s\"", src, src_name, dst, dst_name);
 
-  xbt_dynar_t links = used_routing->get_route(src, dst);
+  //xbt_dynar_t links = used_routing->get_route(src, dst); // COMMENTED BY DAVID
+  xbt_dynar_t links = global_routing->get_route(src_name, dst_name); // ADDED BY DAVID
   route_new(src, dst, links, xbt_dynar_length(links));
 
   action =  surf_action_new(sizeof(s_surf_action_network_GTNETS_t), size, surf_network_model, 0);
index db5364e..56237db 100644 (file)
@@ -32,6 +32,10 @@ typedef struct surf_action_network_CM02 {
 
   int src;  /* saving source id for tracing */
   int dst; /* saving dest id for tracing */
+  
+  char* src_name;  /* saving source id for tracing */ // ADDED BY DAVID
+  char* dst_name; /* saving dest id for tracing */ // ADDED BY DAVID
+  
 } s_surf_action_network_CM02_t, *surf_action_network_CM02_t;
 
 #endif /* _SURF_NETWORK_PRIVATE_H */
index 7074c55..ab5fb0a 100644 (file)
 
 <!-- start added by DAVID -->
 
-<!ELEMENT AS ((AS|host|gateway|router|link|route)*)>
+<!ELEMENT AS (((AS|link)*,ASroute*)|((host|router|link)*,route*))>
+<!ATTLIST AS id CDATA #REQUIRED>
+<!ATTLIST AS routing CDATA #REQUIRED>
+
+<!--<!ELEMENT route (link:ctn*)>
+<!ATTLIST route src CDATA #REQUIRED>
+<!ATTLIST route dst CDATA #REQUIRED>-->
+
+<!ELEMENT ASroute (link:ctn*)>
+<!ATTLIST ASroute src CDATA #REQUIRED>
+<!ATTLIST ASroute dst CDATA #REQUIRED>
+<!ATTLIST ASroute gw_src CDATA #REQUIRED>
+<!ATTLIST ASroute gw_dst CDATA #REQUIRED>
+
+
+<!--<!ELEMENT AS ((AS|host|gateway|router|link|route)*)>
 <!ATTLIST AS id CDATA #REQUIRED>
 <!ATTLIST AS routing CDATA #REQUIRED>
 
 <!ELEMENT gateway EMPTY>
-<!ATTLIST gateway id CDATA #REQUIRED>
+<!ATTLIST gateway id CDATA #REQUIRED>-->
 
 <!-- 
 
index c4573b2..7b9c3ea 100644 (file)
@@ -99,16 +99,16 @@ typedef struct {
  */
 
 // FIXME: the next lines cant be comented without fix the code in network.c file.
-struct s_routing {
-  const char *name;
-  xbt_dict_t host_id; /* char* -> int* */
-  xbt_dynar_t (*get_route)(int src, int dst);
-  xbt_dict_t (*get_onelink_routes)(void);
-  int (*is_router)(int id);
-  void (*finalize)(void);
-  int host_count;
-  int router_count;
-};
+// struct s_routing {
+//   const char *name;
+//   xbt_dict_t host_id; /* char* -> int* */
+//   xbt_dynar_t (*get_route)(int src, int dst);
+//   xbt_dict_t (*get_onelink_routes)(void);
+//   int (*is_router)(int id);
+//   void (*finalize)(void);
+//   int host_count;
+//   int router_count;
+// };
 
 ////////////////////////////////////////////////////////////////////////////////
 // HERE START THE NEW STRUCTURES
@@ -130,7 +130,7 @@ typedef struct s_route s_route_t, *route_t;
 typedef struct s_route_limits s_route_limits_t, *route_limits_t;
 typedef struct s_route_extended s_route_extended_t, *route_extended_t;
 typedef struct s_routing_component s_routing_component_t, *routing_component_t;
-typedef struct s_routing_global s_routing_global_t, *routing_global_t;
+//typedef struct s_routing_global s_routing_global_t, *routing_global_t;
 
 struct s_model_type {
   const char *name;
index b6e1ba8..e508683 100644 (file)
@@ -16,8 +16,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route,surf,"Routing part of surf");
 
 
 // FIXME: the next two lines cant be comented without fix the code in network.c file.
-routing_t used_routing = NULL;
-xbt_dict_t onelink_routes = NULL;
+// routing_t used_routing = NULL;
+// xbt_dict_t onelink_routes = NULL;
+
 // 
 // /* Prototypes of each model */
 // static void routing_model_full_create(size_t size_of_link,void *loopback);
@@ -510,7 +511,7 @@ void routing_model_create(size_t size_of_links, void* loopback) {
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &parse_E_platform_add_parse_AS);
   
   /* DEBUG ONLY */  
-  surfxml_add_callback(ETag_surfxml_platform_cb_list, &DEGUB_exit);
+  //surfxml_add_callback(ETag_surfxml_platform_cb_list, &DEGUB_exit);
 
 }
 
@@ -1509,7 +1510,7 @@ static void DEGUB_exit(void) {
   (*(global_routing->finalize))();
   printf("----------------------------------\n");
   
-  exit(0); 
+  //exit(0); 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
index 4363239..b104f00 100644 (file)
@@ -44,8 +44,9 @@ void create_workstations(void)
 
   xbt_dict_foreach(surf_model_resource_set(surf_cpu_model), cursor, name, cpu) {
     int *id = NULL;
-    if (used_routing && used_routing->host_id)
-      id = xbt_dict_get_or_null(used_routing->host_id,name);
+// COMMENTED BY DAVID
+//     if (used_routing && used_routing->host_id)
+//       id = xbt_dict_get_or_null(used_routing->host_id,name);
 
     workstation_new(name, cpu, id ? *id : 0);
   }
index e011175..613305a 100644 (file)
@@ -79,9 +79,9 @@ static void ptask_update_action_bound(surf_action_workstation_L07_t action)
 
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
-      cpu_L07_t card_src = action->workstation_list[i];
-      cpu_L07_t card_dst = action->workstation_list[j];
-      xbt_dynar_t route = used_routing->get_route(card_src->id, card_dst->id);
+//       cpu_L07_t card_src = action->workstation_list[i]; // COMMENTED BY DAVID
+//       cpu_L07_t card_dst = action->workstation_list[j]; // COMMENTED BY DAVID
+      xbt_dynar_t route = NULL;// used_routing->get_route(card_src->id, card_dst->id); // COMMENTED BY DAVID
       double lat = 0.0;
 
       if (action->communication_amount[i * workstation_nb + j] > 0) {
@@ -399,7 +399,8 @@ static void ptask_finalize(void)
   surf_workstation_model = NULL;
   surf_model_exit(surf_network_model);
   surf_network_model = NULL;
-  used_routing->finalize();
+  // used_routing->finalize(); // COMMENTED BY DAVID
+  global_routing->finalize();
 
   ptask_host_count = 0;
 
@@ -449,10 +450,10 @@ static surf_action_t ptask_execute_parallel_task(int workstation_nb,
   /* Compute the number of affected resources... */
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
-      cpu_L07_t card_src = workstation_list[i];
-      cpu_L07_t card_dst = workstation_list[j];
+//       cpu_L07_t card_src = workstation_list[i]; // COMMENTED BY DAVID
+//       cpu_L07_t card_dst = workstation_list[j]; // COMMENTED BY DAVID
       link_L07_t link;
-      xbt_dynar_t route = used_routing->get_route(card_src->id, card_dst->id);
+      xbt_dynar_t route = NULL; //used_routing->get_route(card_src->id, card_dst->id); // COMMENTED BY DAVID
       double lat = 0.0;
 
       if (communication_amount[i * workstation_nb + j] > 0)
@@ -501,10 +502,10 @@ static surf_action_t ptask_execute_parallel_task(int workstation_nb,
 
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
-      cpu_L07_t card_src = workstation_list[i];
-      cpu_L07_t card_dst = workstation_list[j];
+//       cpu_L07_t card_src = workstation_list[i]; // COMMENTED BY DAVID
+//       cpu_L07_t card_dst = workstation_list[j]; // COMMENTED BY DAVID
       link_L07_t link;
-      xbt_dynar_t route = used_routing->get_route(card_src->id, card_dst->id);
+      xbt_dynar_t route = NULL;// used_routing->get_route(card_src->id, card_dst->id); // COMMENTED BY DAVID
 
       if (communication_amount[i * workstation_nb + j] == 0.0)
         continue;
@@ -574,10 +575,10 @@ static surf_action_t ptask_action_sleep(void *cpu, double duration)
 
 static xbt_dynar_t ptask_get_route(void *src, void *dst)
 {
-  cpu_L07_t host_src = src;
-  cpu_L07_t host_dst = dst;
+//   cpu_L07_t host_src = src; // COMMENTED BY DAVID
+//   cpu_L07_t host_dst = dst; // COMMENTED BY DAVID
 
-  return used_routing->get_route(host_src->id, host_dst->id);
+  return NULL;// used_routing->get_route(host_src->id, host_dst->id); // COMMENTED BY DAVID
 }
 
 static double ptask_get_link_bandwidth(const void *link)