Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Huge set of modifications to restore more uniform APIs when dealing with src and...
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 28 Sep 2010 08:54:06 +0000 (08:54 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 28 Sep 2010 08:54:06 +0000 (08:54 +0000)
 * GTNets compiles but is still not functionnal
 * Tracing should have the same issue :(

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8269 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/surf/surf.h
src/simdag/sd_workstation.c
src/surf/network.c
src/surf/network_constant.c
src/surf/network_gtnets.c
src/surf/network_gtnets_private.h
src/surf/network_private.h
src/surf/network_vivaldi.c
src/surf/surf_private.h
src/surf/workstation.c
src/surf/workstation_ptask_L07.c

index d1d9964..6919f83 100644 (file)
@@ -181,9 +181,9 @@ XBT_PUBLIC_DATA(routing_global_t) global_routing; // ADDED BY DAVID
       */
      typedef struct surf_network_model_extension_public {
        surf_action_t(*communicate) (const char *src_name,
-                                    const char *dst_name, int src, int dst,
+                                    const char *dst_name,
                                     double size, double rate);
-       xbt_dynar_t(*get_route) (int src, int dst);
+       xbt_dynar_t(*get_route) (const char *src_name, const char *dst_name);
        double (*get_link_bandwidth) (const void *link);
        double (*get_link_latency) (const void *link);
        int (*link_shared) (const void *link);
index da5b5d3..1468d73 100644 (file)
@@ -197,22 +197,15 @@ const SD_link_t *SD_route_get_list(SD_workstation_t src, SD_workstation_t dst)
     sd_global->recyclable_route = xbt_new(SD_link_t, SD_link_get_number());
   }
 
-  surf_src = &src->surf_workstation;
-  surf_dst = &dst->surf_workstation;
-  surf_route = surf_workstation_model->extension.workstation.get_route(
-                 (void*)SD_workstation_get_name(src),(void*)SD_workstation_get_name(dst));
-
-  if(surf_route == NULL)
-  {
-         INFO0("PBLM1 surf_route == NULL");
-  }
+  surf_src = src->surf_workstation;
+  surf_dst = dst->surf_workstation;
+  surf_route = surf_workstation_model->extension.workstation.get_route(surf_src,surf_dst);
 
   xbt_dynar_foreach(surf_route, cpt, surf_link) {
     link_name = surf_resource_name(surf_link);
     sd_global->recyclable_route[cpt] =
       xbt_dict_get(sd_global->links, link_name);
   }
-  INFO0("FIN");
   return sd_global->recyclable_route;
 }
 
index 88232f0..cb676e7 100644 (file)
@@ -484,7 +484,7 @@ static void net_update_resource_state(void *id,
 
 
 static surf_action_t net_communicate(const char *src_name, const char *dst_name,
-                                 int src, int dst, double size, double rate)
+                                 double size, double rate)
 {
   unsigned int i;
   link_CM02_t link;
@@ -596,10 +596,6 @@ static surf_action_t net_communicate(const char *src_name, const char *dst_name,
   }  /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 
-  /* saving the src and dst of this communication */
-  action->src = src;
-  action->dst = dst;
-
   XBT_OUT;
 
   return (surf_action_t) action;
index 7daaeb4..8983d39 100644 (file)
@@ -110,7 +110,7 @@ static void netcste_update_resource_state(void *id,
 }
 
 static surf_action_t netcste_communicate(const char *src_name, const char *dst_name,
-                                 int src, int dst, double size, double rate)
+                                 double size, double rate)
 {
   surf_action_network_Constant_t action = NULL;
 
index 693db62..a068ec9 100644 (file)
@@ -13,8 +13,7 @@ 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; // COMMENTED BY DAVID
-extern routing_global_t global_routing; // ADDED BY DAVID
+extern routing_global_t global_routing;
 
 double sg_gtnets_jitter=0.0;
 int sg_gtnets_jitter_seed=10;
@@ -132,23 +131,25 @@ static void parse_link_init(void)
 /* Create the gtnets topology based on routing strategy */
 static void create_gtnets_topology()
 {
-// COMMENTED BY DAVID
 //  xbt_dict_cursor_t cursor = NULL;
 //  char *key, *data;
-//   xbt_dict_t onelink_routes = used_routing->get_onelink_routes();
+//   xbt_dict_t onelink_routes = global_routing->get_onelink_routes();
 //   xbt_assert0(onelink_routes, "Error onelink_routes was not initialized");
 //
 //   DEBUG0("Starting topology generation");
-//
+// À refaire plus tard. Il faut prendre la liste des hôtes/routeurs (dans routing)
+// À partir de cette liste, on les numérote.
+// Ensuite, on peut utiliser les id pour refaire les appels GTNets qui suivent.
+
 //   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);
+//     DEBUG3("Link (#%d), src (#%s), dst (#%s)", ((network_link_GTNETS_t)(link->link_ptr))->id , link->src, link->dst);
 //     DEBUG0("Calling one link route");
-//     if(used_routing->is_router(link->src_id)){
+//     if(global_routing->is_router(link->src)){
 //             gtnets_add_router(link->src_id);
 //     }
-//     if(used_routing->is_router(link->dst_id)){
+//     if(global_routing->is_router(link->dst)){
 //             gtnets_add_router(link->dst_id);
 //     }
 //     route_onehop_new(link->src_id, link->dst_id, (network_link_GTNETS_t)(link->link_ptr));
@@ -158,7 +159,6 @@ static void create_gtnets_topology()
 //   if (XBT_LOG_ISENABLED(surf_network_gtnets, xbt_log_priority_debug)) {
 //       gtnets_print_topology();
 //   }
-
 }
 
 /* Main XML parsing */
@@ -319,16 +319,19 @@ static void update_resource_state(void *id,
 
 /* Max durations are not supported */
 static surf_action_t communicate(const char *src_name, const char *dst_name,
-                                 int src, int dst, double size, double rate)
+                                 double size, double rate)
 {
+  int src,dst;
+
+  // Utiliser le dictionnaire définit dans create_gtnets_topology pour initialiser correctement src et dst
+  src=dst=-1;
   surf_action_network_GTNETS_t action = NULL;
 
   xbt_assert0((src >= 0 && dst >= 0), "Either src or dst have invalid id (id<0)");
 
   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); // COMMENTED BY DAVID
-  xbt_dynar_t links = global_routing->get_route(src_name, dst_name); // ADDED BY DAVID
+  xbt_dynar_t links = global_routing->get_route(src_name, dst_name);
   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 f712870..145c10f 100644 (file)
@@ -19,11 +19,6 @@ typedef struct network_link_GTNETS {
   int id;
 } s_network_link_GTNETS_t, *network_link_GTNETS_t;
 
-typedef struct network_card_GTNETS {
-  char *name;
-  int id;
-} s_network_card_GTNETS_t, *network_card_GTNETS_t;
-
 typedef struct surf_action_network_GTNETS {
   s_surf_action_t generic_action;
   double latency;
@@ -33,7 +28,8 @@ typedef struct surf_action_network_GTNETS {
   int suspended;
 } s_surf_action_network_GTNETS_t, *surf_action_network_GTNETS_t;
 
-//extern xbt_dict_t network_card_set;
+xbt_dict_t network_card_ids;
+
 
 
 #endif /* _SURF_NETWORK_PRIVATE_H */
index 56237db..ff198b5 100644 (file)
@@ -29,12 +29,8 @@ typedef struct surf_action_network_CM02 {
   double rate;
   int latency_limited;
   int suspended;
-
-  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
+  char* src_name;
+  char* dst_name;
   
 } s_surf_action_network_CM02_t, *surf_action_network_CM02_t;
 
index 74afcc4..0fb5da1 100644 (file)
@@ -126,7 +126,7 @@ static void netviva_update_resource_state(void *id,
 }
 
 static surf_action_t netviva_communicate(const char *src_name, const char *dst_name,
-                                 int src, int dst, double size, double rate)
+                                  double size, double rate)
 {
   surf_action_network_Vivaldi_t action = NULL;
   netviva_coords_t c1,c2;
index 2ab732f..a076a98 100644 (file)
@@ -86,8 +86,8 @@ int __surf_is_absolute_file_path(const char *file_path);
  * One link routing list
  */
 typedef struct {
-       int src_id;
-       int dst_id;
+       char *src;
+       char *dst;
        void *link_ptr;
 }s_onelink, *s_onelink_t;
 
@@ -171,6 +171,8 @@ struct s_routing_global {
   void *loopback;
   size_t size_of_link;
   xbt_dynar_t (*get_route)(const char* src, const char* dst);
+  xbt_dict_t (*get_onelink_routes)(void);
+  int (*is_router)(const char *name);
   void (*finalize)(void);
   xbt_dynar_t last_route;
 };
index b104f00..08365bd 100644 (file)
@@ -12,7 +12,6 @@
 typedef struct workstation_CLM03 {
   s_surf_resource_t generic_resource;   /* Must remain first to add this to a trace */
   void *cpu;
-  int id;
 } s_workstation_CLM03_t, *workstation_CLM03_t;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf,
@@ -21,14 +20,13 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf,
 surf_model_t surf_workstation_model = NULL;
 
 static workstation_CLM03_t workstation_new(const char *name,
-                                           void *cpu, int id)
+                                           void *cpu)
 {
   workstation_CLM03_t workstation = xbt_new0(s_workstation_CLM03_t, 1);
 
   workstation->generic_resource.model = surf_workstation_model;
   workstation->generic_resource.name = xbt_strdup(name);
   workstation->cpu = cpu;
-  workstation->id = id;
 
   xbt_dict_set(surf_model_resource_set(surf_workstation_model), name,
                workstation, surf_resource_free);
@@ -43,12 +41,7 @@ void create_workstations(void)
   void *cpu = NULL;
 
   xbt_dict_foreach(surf_model_resource_set(surf_cpu_model), cursor, name, cpu) {
-    int *id = NULL;
-// 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);
+         workstation_new(name, cpu);
   }
 }
 
@@ -210,7 +203,7 @@ static surf_action_t ws_communicate(void *workstation_src,
   workstation_CLM03_t dst = (workstation_CLM03_t) workstation_dst;
   return surf_network_model->extension.network.
     communicate(surf_resource_name(src->cpu), surf_resource_name(dst->cpu),
-                src->id, dst->id, size, rate);
+                size, rate);
 }
 
 static e_surf_resource_state_t ws_get_state(void *workstation)
@@ -245,10 +238,8 @@ static surf_action_t ws_execute_parallel_task(int workstation_nb,
 /* returns an array of network_link_CM02_t */
 static xbt_dynar_t ws_get_route(void *src, void *dst)
 {
-  workstation_CLM03_t workstation_src = (workstation_CLM03_t) src;
-  workstation_CLM03_t workstation_dst = (workstation_CLM03_t) dst;
-  return surf_network_model->extension.network.get_route(workstation_src->id,
-                                                         workstation_dst->id);
+  return surf_network_model->extension.network.get_route(surf_resource_name(src),
+                        surf_resource_name(src));
 }
 
 static double ws_get_link_bandwidth(const void *link)
index 37ef666..f073976 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]; // 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
+      xbt_dynar_t route = global_routing->get_route(surf_resource_name(action->workstation_list[i]),
+                 surf_resource_name(action->workstation_list[j]));
+
       double lat = 0.0;
 
       if (action->communication_amount[i * workstation_nb + j] > 0) {
@@ -450,10 +450,9 @@ 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]; // COMMENTED BY DAVID
-//       cpu_L07_t card_dst = workstation_list[j]; // COMMENTED BY DAVID
       link_L07_t link;
-      xbt_dynar_t route = NULL; //used_routing->get_route(card_src->id, card_dst->id); // COMMENTED BY DAVID
+      xbt_dynar_t route = global_routing->get_route(surf_resource_name(workstation_list[i]),
+                                                                                                                 surf_resource_name(workstation_list[j]));
       double lat = 0.0;
 
       if (communication_amount[i * workstation_nb + j] > 0)
@@ -502,10 +501,9 @@ 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]; // COMMENTED BY DAVID
-//       cpu_L07_t card_dst = workstation_list[j]; // COMMENTED BY DAVID
       link_L07_t link;
-      xbt_dynar_t route = NULL;// used_routing->get_route(card_src->id, card_dst->id); // COMMENTED BY DAVID
+      xbt_dynar_t route = global_routing->get_route(surf_resource_name(workstation_list[i]),
+                                                                                                                 surf_resource_name(workstation_list[j]));
 
       if (communication_amount[i * workstation_nb + j] == 0.0)
         continue;
@@ -575,8 +573,7 @@ static surf_action_t ptask_action_sleep(void *cpu, double duration)
 
 static xbt_dynar_t ptask_get_route(void *src, void *dst)
 {
-       return global_routing->get_route((char *) src,(char *) dst);
-       //return NULL; used_routing->get_route(host_src->id, host_dst->id); // COMMENTED BY DAVID
+       return global_routing->get_route( surf_resource_name(src), surf_resource_name(dst));
 }
 
 static double ptask_get_link_bandwidth(const void *link)