Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill routing_get_route(), use routing_get_route_and_latency() instead
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 15 Nov 2011 01:01:25 +0000 (02:01 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 15 Nov 2011 01:01:25 +0000 (02:01 +0100)
src/instr/instr_interface.c
src/instr/instr_routing.c
src/surf/network.c
src/surf/network_im.c
src/surf/surf_private.h
src/surf/surf_routing.c
src/surf/surf_routing_dijkstra.c
src/surf/surf_routing_floyd.c
src/surf/workstation_ptask_L07.c
teshsuite/simdag/platforms/flatifier.c

index 75090b8..b0ac44e 100644 (file)
@@ -138,7 +138,8 @@ static void instr_user_srcdst_variable(double time,
                               double value,
                               InstrUserVariable what)
 {
                               double value,
                               InstrUserVariable what)
 {
-  xbt_dynar_t route = routing_get_route (src, dst);
+  xbt_dynar_t route;
+  routing_get_route_and_latency (src, dst, &route,NULL,1);
   unsigned int i;
   void *link;
   xbt_dynar_foreach (route, i, link) {
   unsigned int i;
   void *link;
   xbt_dynar_foreach (route, i, link) {
index e75817c..f009b2a 100644 (file)
@@ -113,7 +113,7 @@ static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t
         xbt_ex_t e;
 
         TRY {
         xbt_ex_t e;
 
         TRY {
-          route = routing_get_route(child1_name, child2_name);
+          routing_get_route_and_latency(child1_name, child2_name, &route, NULL, 1);
         } CATCH(e) {
           xbt_ex_free(e);
         }
         } CATCH(e) {
           xbt_ex_free(e);
         }
@@ -422,7 +422,8 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb
           strcmp (child1_name, child2_name) != 0){
 
         // FIXME factorize route creation once possible
           strcmp (child1_name, child2_name) != 0){
 
         // FIXME factorize route creation once possible
-        xbt_dynar_t route = routing_get_route (child1_name, child2_name);
+        xbt_dynar_t route;
+        routing_get_route_and_latency (child1_name, child2_name,&route,NULL,1);
         if (TRACE_onelink_only()){
           if (xbt_dynar_length (route) > 1) continue;
         }
         if (TRACE_onelink_only()){
           if (xbt_dynar_length (route) > 1) continue;
         }
index 0c45add..8753f1a 100644 (file)
@@ -413,7 +413,8 @@ static void net_update_actions_state(double now, double delta)
     }
 #ifdef HAVE_TRACING
     if (TRACE_is_enabled()) {
     }
 #ifdef HAVE_TRACING
     if (TRACE_is_enabled()) {
-      xbt_dynar_t route = routing_get_route(action->src_name, action->dst_name);
+      xbt_dynar_t route;
+      routing_get_route_and_latency(action->src_name, action->dst_name,&route,NULL,1);
       link_CM02_t link;
       unsigned int i;
       xbt_dynar_foreach(route, i, link) {
       link_CM02_t link;
       unsigned int i;
       xbt_dynar_foreach(route, i, link) {
@@ -589,7 +590,7 @@ static surf_action_t net_communicate(const char *src_name,
   routing_get_route_and_latency(src_name, dst_name, &route, &latency, 0);
 
   if (sg_network_fullduplex == 1) {
   routing_get_route_and_latency(src_name, dst_name, &route, &latency, 0);
 
   if (sg_network_fullduplex == 1) {
-    back_route = routing_get_route(dst_name, src_name);
+    routing_get_route_and_latency(dst_name, src_name, &back_route,NULL,1);
   }
 
   /* LARGE PLATFORMS HACK:
   }
 
   /* LARGE PLATFORMS HACK:
@@ -722,7 +723,9 @@ static surf_action_t net_communicate(const char *src_name,
 
 static xbt_dynar_t net_get_route(const char *src, const char *dst)
 {
 
 static xbt_dynar_t net_get_route(const char *src, const char *dst)
 {
-  return routing_get_route(src, dst);
+  xbt_dynar_t route;
+  routing_get_route_and_latency(src, dst,&route, NULL,1);
+  return route;
 }
 
 static double net_get_link_bandwidth(const void *link)
 }
 
 static double net_get_link_bandwidth(const void *link)
index 48447e1..2ee4bab 100644 (file)
@@ -610,7 +610,7 @@ static surf_action_t im_net_communicate(const char *src_name,
 
 
   if (sg_network_fullduplex == 1) {
 
 
   if (sg_network_fullduplex == 1) {
-    back_route = routing_get_route(dst_name, src_name);
+    routing_get_route_and_latency(dst_name, src_name, &back_route, NULL,1);
   }
 
   /* LARGE PLATFORMS HACK:
   }
 
   /* LARGE PLATFORMS HACK:
@@ -747,7 +747,9 @@ static surf_action_t im_net_communicate(const char *src_name,
 
 static xbt_dynar_t im_net_get_route(const char *src, const char *dst)
 {
 
 static xbt_dynar_t im_net_get_route(const char *src, const char *dst)
 {
-  return routing_get_route(src, dst);
+  xbt_dynar_t route;
+  routing_get_route_and_latency(src, dst,&route,NULL,1);
+  return route;
 }
 
 static double im_net_get_link_bandwidth(const void *link)
 }
 
 static double im_net_get_link_bandwidth(const void *link)
index 323885f..99af1ca 100644 (file)
@@ -176,7 +176,6 @@ XBT_PUBLIC(void) routing_register_callbacks(void);
 XBT_PUBLIC(void) generic_free_route(route_t route); // FIXME rename to routing_route_free
 
 
 XBT_PUBLIC(void) generic_free_route(route_t route); // FIXME rename to routing_route_free
 
 
-XBT_PUBLIC(xbt_dynar_t) routing_get_route(const char *src, const char *dst);
 XBT_PUBLIC(void) routing_get_route_and_latency(const char *src, const char *dst, //FIXME too much functions avail?
                               xbt_dynar_t * route, double *latency, int cleanup);
 
 XBT_PUBLIC(void) routing_get_route_and_latency(const char *src, const char *dst, //FIXME too much functions avail?
                               xbt_dynar_t * route, double *latency, int cleanup);
 
index 42790c6..61c0be4 100644 (file)
@@ -627,7 +627,17 @@ static void _get_route_and_latency(const char *src, const char *dst,
 }
 
 /**
 }
 
 /**
- * \brief Generic function for get_route, get_route_no_cleanup, and get_latency
+ * \brief Find a route between hosts
+ *
+ * \param src the source host name
+ * \param dst the destination host name
+ * \param route where to store the list of links (or NULL if you are not interested in it)
+ * \param latency where to store the latency experienced on the path (or NULL if not interested)
+ * \param cleanup boolean whether the dynar should be automatically destroyed or not
+ *
+ * walk through the routing components tree and find a route between hosts
+ * by calling the differents "get_route" functions in each routing component.
+ * No need to free the returned dynar. It will be freed at the next call.
  */
 void routing_get_route_and_latency(const char *src, const char *dst,
                               xbt_dynar_t * route, double *latency, int cleanup)
  */
 void routing_get_route_and_latency(const char *src, const char *dst,
                               xbt_dynar_t * route, double *latency, int cleanup)
@@ -644,22 +654,6 @@ void routing_get_route_and_latency(const char *src, const char *dst,
   }
 }
 
   }
 }
 
-/**
- * \brief Find a route between hosts
- *
- * \param src the source host name 
- * \param dst the destination host name
- * 
- * walk through the routing components tree and find a route between hosts
- * by calling the differents "get_route" functions in each routing component.
- * No need to free the returned dynar. It will be freed at the next call.
- */
-xbt_dynar_t routing_get_route(const char *src, const char *dst) {
-  xbt_dynar_t route = NULL;
-  routing_get_route_and_latency(src, dst, &route, NULL, 1);
-  return route;
-}
-
 /**
  * \brief Generic method: find a route between hosts
  *
 /**
  * \brief Generic method: find a route between hosts
  *
index 02aef55..b77cfaf 100644 (file)
@@ -360,8 +360,8 @@ static void dijkstra_get_route(AS_t asg,
 
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id
         && strcmp(gw_dst, prev_gw_src)) {
 
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id
         && strcmp(gw_dst, prev_gw_src)) {
-      xbt_dynar_t e_route_as_to_as =
-          routing_get_route(gw_dst, prev_gw_src);
+      xbt_dynar_t e_route_as_to_as;
+      routing_get_route_and_latency(gw_dst, prev_gw_src,&e_route_as_to_as,NULL,1);
       xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
                   gw_dst, prev_gw_src);
       links = e_route_as_to_as;
       xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
                   gw_dst, prev_gw_src);
       links = e_route_as_to_as;
index 7e4f4c2..cd869e9 100644 (file)
@@ -108,8 +108,8 @@ static void floyd_get_route(AS_t asg, const char *src, const char *dst, route_t
 
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && !first
         && strcmp(gw_dst, prev_gw_src)) {
 
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && !first
         && strcmp(gw_dst, prev_gw_src)) {
-      xbt_dynar_t e_route_as_to_as =
-          routing_get_route(gw_dst, prev_gw_src);
+      xbt_dynar_t e_route_as_to_as;
+      routing_get_route_and_latency(gw_dst, prev_gw_src,&e_route_as_to_as,NULL,1);
       xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
                   gw_dst, prev_gw_src);
       links = e_route_as_to_as;
       xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"",
                   gw_dst, prev_gw_src);
       links = e_route_as_to_as;
index c558a2e..714590b 100644 (file)
@@ -81,13 +81,13 @@ 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++) {
 
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
-      xbt_dynar_t route =
-          routing_get_route(surf_resource_name
-                                    (action->workstation_list[i]),
-                                    surf_resource_name(action->
-                                                       workstation_list
-                                                       [j]));
+      xbt_dynar_t route;
+      routing_get_route_and_latency(surf_resource_name
+          (action->workstation_list[i]),
+          surf_resource_name(action->workstation_list[j]),
+          &route, NULL,1);
 
 
+      // FIXME do we really need to recompute the latency here?
       double lat = 0.0;
 
       if (action->communication_amount[i * workstation_nb + j] > 0) {
       double lat = 0.0;
 
       if (action->communication_amount[i * workstation_nb + j] > 0) {
@@ -462,11 +462,11 @@ 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++) {
       link_L07_t link;
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
       link_L07_t link;
-      xbt_dynar_t route =
-          routing_get_route(surf_resource_name
-                                    (workstation_list[i]),
-                                    surf_resource_name(workstation_list
-                                                       [j]));
+      xbt_dynar_t route;
+      routing_get_route_and_latency(
+          surf_resource_name(workstation_list[i]),
+          surf_resource_name(workstation_list[j]),
+          &route,NULL,1); // FIXME: do we want to recompute the latency?
       double lat = 0.0;
 
       if (communication_amount[i * workstation_nb + j] > 0)
       double lat = 0.0;
 
       if (communication_amount[i * workstation_nb + j] > 0)
@@ -516,11 +516,11 @@ 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++) {
       link_L07_t link;
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
       link_L07_t link;
-      xbt_dynar_t route =
-          routing_get_route(surf_resource_name
-                                    (workstation_list[i]),
-                                    surf_resource_name(workstation_list
-                                                       [j]));
+      xbt_dynar_t route;
+      routing_get_route_and_latency(
+          surf_resource_name(workstation_list[i]),
+          surf_resource_name(workstation_list[j]),
+          &route,NULL,1);
 
       if (communication_amount[i * workstation_nb + j] == 0.0)
         continue;
 
       if (communication_amount[i * workstation_nb + j] == 0.0)
         continue;
@@ -591,8 +591,11 @@ static surf_action_t ptask_action_sleep(void *cpu, double duration)
 
 static xbt_dynar_t ptask_get_route(void *src, void *dst) // FIXME: kill that callback kind?
 {
 
 static xbt_dynar_t ptask_get_route(void *src, void *dst) // FIXME: kill that callback kind?
 {
-  return routing_get_route(surf_resource_name(src),
-                                   surf_resource_name(dst));
+  xbt_dynar_t route;
+  routing_get_route_and_latency(
+      surf_resource_name(src), surf_resource_name(dst),
+      &route,NULL,1);
+  return route;
 }
 
 static double ptask_get_link_bandwidth(const void *link)
 }
 
 static double ptask_get_link_bandwidth(const void *link)
index 7b3e375..7e7bb7f 100644 (file)
@@ -136,7 +136,8 @@ int main(int argc, char **argv)
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
-                               xbt_dynar_t route = routing_get_route(src,dst);
+                               xbt_dynar_t route;
+                               routing_get_route_and_latency(src,dst,&route,NULL,1);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
@@ -153,7 +154,8 @@ int main(int argc, char **argv)
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
-                               xbt_dynar_t route = routing_get_route(src,dst);
+                               xbt_dynar_t route;
+                               routing_get_route_and_latency(src,dst,&route,NULL,1);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
@@ -176,7 +178,8 @@ int main(int argc, char **argv)
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                                          ,src
                                          ,dst);
-                               xbt_dynar_t route = routing_get_route(src,dst);
+                               xbt_dynar_t route;
+                               routing_get_route_and_latency(src,dst,&route,NULL,1);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
@@ -191,9 +194,9 @@ int main(int argc, char **argv)
                  xbt_lib_foreach(host_lib, cursor_dst, dst, value) //to host
                  {
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
                  xbt_lib_foreach(host_lib, cursor_dst, dst, value) //to host
                  {
                                printf("  <route src=\"%s\" dst=\"%s\">\n       "
-                                         ,src
-                                         ,dst);
-                               xbt_dynar_t route = routing_get_route(src,dst);
+                                         ,src, dst);
+                               xbt_dynar_t route;
+                               routing_get_route_and_latency(src,dst,&route, NULL,1);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);
                                for(i=0;i<xbt_dynar_length(route) ;i++)
                                {
                                        void *link = xbt_dynar_get_as(route,i,void *);