Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
and now, blow up the routing_models table \o/
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 12 Feb 2016 00:48:12 +0000 (01:48 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 12 Feb 2016 00:48:12 +0000 (01:48 +0100)
include/simgrid/platf.h
src/surf/surf_routing.cpp
src/surf/surf_routing_cluster.cpp
src/surf/surf_routing_cluster_fat_tree.cpp
src/surf/surf_routing_cluster_torus.cpp
src/surf/surf_routing_dijkstra.cpp
src/surf/surf_routing_floyd.cpp
src/surf/surf_routing_full.cpp
src/surf/surf_routing_none.cpp
src/surf/surf_routing_private.hpp
src/surf/surf_routing_vivaldi.cpp

index 75b26ff..a691131 100644 (file)
@@ -31,11 +31,6 @@ typedef enum {
   SURF_CLUSTER_TORUS = 0
 } e_surf_cluster_topology_t;
 
   SURF_CLUSTER_TORUS = 0
 } e_surf_cluster_topology_t;
 
-
-typedef struct s_model_type {
-  AS_t (*create) ();
-} s_routing_model_description_t, *routing_model_description_t;
-
 /* ***************************************** */
 /*
  * Platform creation functions. Instead of passing 123 arguments to the creation functions
 /* ***************************************** */
 /*
  * Platform creation functions. Instead of passing 123 arguments to the creation functions
index acb39d7..e36b003 100644 (file)
 #include "storage_interface.hpp"
 #include "src/surf/platform.hpp"
 #include "surf/surfxml_parse_values.h"
 #include "storage_interface.hpp"
 #include "src/surf/platform.hpp"
 #include "surf/surfxml_parse_values.h"
+
+#include "src/surf/surf_routing_cluster_torus.hpp"
+#include "src/surf/surf_routing_cluster_fat_tree.hpp"
+#include "src/surf/surf_routing_dijkstra.hpp"
+#include "src/surf/surf_routing_floyd.hpp"
+#include "src/surf/surf_routing_full.hpp"
 #include "src/surf/surf_routing_vivaldi.hpp"
 
 /*************
 #include "src/surf/surf_routing_vivaldi.hpp"
 
 /*************
@@ -85,19 +91,6 @@ typedef enum {
   SURF_MODEL_FAT_TREE_CLUSTER,
 } e_routing_types;
 
   SURF_MODEL_FAT_TREE_CLUSTER,
 } e_routing_types;
 
-struct s_model_type routing_models[] = {
-  {model_full_create},
-  {model_floyd_create},
-  {model_dijkstra_create},
-  {model_dijkstracache_create},
-  {model_none_create},
-  {model_vivaldi_create},
-  {model_cluster_create},
-  {model_torus_cluster_create},
-  {model_fat_tree_cluster_create},
-  {NULL}
-};
-
 /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
 void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t netcard_arg)
 {
 /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
 void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t netcard_arg)
 {
@@ -152,32 +145,30 @@ void sg_platf_new_trace(sg_platf_trace_cbarg_t trace)
 void routing_AS_begin(sg_platf_AS_cbarg_t AS)
 {
   XBT_DEBUG("routing_AS_begin");
 void routing_AS_begin(sg_platf_AS_cbarg_t AS)
 {
   XBT_DEBUG("routing_AS_begin");
-  routing_model_description_t model = NULL;
 
   xbt_assert(NULL == xbt_lib_get_or_null(as_router_lib, AS->id, ROUTING_ASR_LEVEL),
       "Refusing to create a second AS called \"%s\".", AS->id);
 
 
   xbt_assert(NULL == xbt_lib_get_or_null(as_router_lib, AS->id, ROUTING_ASR_LEVEL),
       "Refusing to create a second AS called \"%s\".", AS->id);
 
-  _sg_cfg_init_status = 2; /* horrible hack: direct access to the global
-                            * controlling the level of configuration to prevent
-                            * any further config */
+  _sg_cfg_init_status = 2; /* HACK: direct access to the global controlling the level of configuration to prevent
+                            * any further config now that we created some real content */
+
+  simgrid::surf::As *new_as = NULL;
 
   /* search the routing model */
   switch(AS->routing){
 
   /* search the routing model */
   switch(AS->routing){
-    case A_surfxml_AS_routing_Cluster:               model = &routing_models[SURF_MODEL_CLUSTER];break;
-    case A_surfxml_AS_routing_ClusterTorus:    model = &routing_models[SURF_MODEL_TORUS_CLUSTER];break;
-    case A_surfxml_AS_routing_ClusterFatTree:  model = &routing_models[SURF_MODEL_FAT_TREE_CLUSTER];break;
-    case A_surfxml_AS_routing_Dijkstra:              model = &routing_models[SURF_MODEL_DIJKSTRA];break;
-    case A_surfxml_AS_routing_DijkstraCache:         model = &routing_models[SURF_MODEL_DIJKSTRACACHE];break;
-    case A_surfxml_AS_routing_Floyd:                 model = &routing_models[SURF_MODEL_FLOYD];break;
-    case A_surfxml_AS_routing_Full:                  model = &routing_models[SURF_MODEL_FULL];break;
-    case A_surfxml_AS_routing_None:                  model = &routing_models[SURF_MODEL_NONE];break;
-    case A_surfxml_AS_routing_Vivaldi:               model = &routing_models[SURF_MODEL_VIVALDI];break;
-    default: xbt_die("Not a valid model!!!");
-    break;
+    case A_surfxml_AS_routing_Cluster:        new_as = new simgrid::surf::AsCluster();        break;
+    case A_surfxml_AS_routing_ClusterTorus:   new_as = new simgrid::surf::AsClusterTorus();   break;
+    case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::surf::AsClusterFatTree(); break;
+    case A_surfxml_AS_routing_Dijkstra:       new_as = new simgrid::surf::AsDijkstra(0);      break;
+    case A_surfxml_AS_routing_DijkstraCache:  new_as = new simgrid::surf::AsDijkstra(1);      break;
+    case A_surfxml_AS_routing_Floyd:          new_as = new simgrid::surf::AsFloyd();          break;
+    case A_surfxml_AS_routing_Full:           new_as = new simgrid::surf::AsFull();           break;
+    case A_surfxml_AS_routing_None:           new_as = new simgrid::surf::AsNone();           break;
+    case A_surfxml_AS_routing_Vivaldi:        new_as = new simgrid::surf::AsVivaldi();        break;
+    default:                                  xbt_die("Not a valid model!");                  break;
   }
 
   /* make a new routing component */
   }
 
   /* make a new routing component */
-  simgrid::surf::As *new_as = model->create();
 
   new_as->p_hierarchy = SURF_ROUTING_NULL;
   new_as->p_name = xbt_strdup(AS->id);
 
   new_as->p_hierarchy = SURF_ROUTING_NULL;
   new_as->p_name = xbt_strdup(AS->id);
index 6c284fc..ebb2a58 100644 (file)
@@ -13,11 +13,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"
  * Note that a router is created, easing the interconnexion with the rest of the world.
  */
 
  * Note that a router is created, easing the interconnexion with the rest of the world.
  */
 
-AS_t model_cluster_create(void)
-{
-  return new simgrid::surf::AsCluster();
-}
-
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {
 
index 9ecbb8a..5d9bc0c 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_fat_tree, surf, "Routing for fat trees");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_fat_tree, surf, "Routing for fat trees");
 
-AS_t model_fat_tree_cluster_create(void)
-{
-  return new simgrid::surf::AsClusterFatTree();
-}
-
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {
 
index 03bedd5..1288cf8 100644 (file)
@@ -25,11 +25,6 @@ inline unsigned int *rankId_to_coords(int rankId, xbt_dynar_t dimensions)
 }
 
 
 }
 
 
-AS_t model_torus_cluster_create(void)
-{
-  return new simgrid::surf::AsClusterTorus();
-}
-
 namespace simgrid {
   namespace surf {
     AsClusterTorus::AsClusterTorus():AsCluster() {
 namespace simgrid {
   namespace surf {
     AsClusterTorus::AsClusterTorus():AsCluster() {
index ccdeaad..c5cf6a3 100644 (file)
@@ -36,14 +36,6 @@ static void graph_edge_data_free(void *e) // FIXME: useless code duplication
   }
 }
 
   }
 }
 
-AS_t model_dijkstra_create(void){
-  return new simgrid::surf::AsDijkstra(0);
-}
-
-AS_t model_dijkstracache_create(void){
-  return new simgrid::surf::AsDijkstra(1);
-}
-
 /* Utility functions */
 
 namespace simgrid {
 /* Utility functions */
 
 namespace simgrid {
index ffe8e5a..bed7289 100644 (file)
@@ -14,11 +14,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
 #define TO_FLOYD_PRED(i,j) (p_predecessorTable)[(i)+(j)*table_size]
 #define TO_FLOYD_LINK(i,j) (p_linkTable)[(i)+(j)*table_size]
 
 #define TO_FLOYD_PRED(i,j) (p_predecessorTable)[(i)+(j)*table_size]
 #define TO_FLOYD_LINK(i,j) (p_linkTable)[(i)+(j)*table_size]
 
-AS_t model_floyd_create(void)
-{
-  return new simgrid::surf::AsFloyd();
-}
-
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {
 
index f80b2f6..49e71cc 100644 (file)
@@ -12,11 +12,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 
 #define TO_ROUTE_FULL(i,j) p_routingTable[(i)+(j)*table_size]
 
 
 #define TO_ROUTE_FULL(i,j) p_routingTable[(i)+(j)*table_size]
 
-AS_t model_full_create(void)
-{
-  return new simgrid::surf::AsFull();
-}
-
 namespace simgrid {
 namespace surf {
 void AsFull::Seal() {
 namespace simgrid {
 namespace surf {
 void AsFull::Seal() {
index a4e5059..86d41d4 100644 (file)
@@ -9,11 +9,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
 
-AS_t model_none_create(void)
-{
-  return new simgrid::surf::AsNone();
-}
-
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {
 
index 36c6f73..5904dc9 100644 (file)
@@ -50,42 +50,21 @@ XBT_PRIVATE sg_platf_route_cbarg_t generic_get_bypassroute(AS_t rc,
  * produced route */
 XBT_PRIVATE sg_platf_route_cbarg_t generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
                                    sg_platf_route_cbarg_t data, int preserve_order);
  * produced route */
 XBT_PRIVATE sg_platf_route_cbarg_t generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
                                    sg_platf_route_cbarg_t data, int preserve_order);
-XBT_PRIVATE AS_t
-generic_autonomous_system_exist(AS_t rc, char *element);
-XBT_PRIVATE AS_t
-generic_processing_units_exist(AS_t rc, char *element);
-void generic_src_dst_check(AS_t rc, sg_netcard_t src,
-    sg_netcard_t dst);
+XBT_PRIVATE AS_t generic_autonomous_system_exist(AS_t rc, char *element);
+XBT_PRIVATE AS_t generic_processing_units_exist(AS_t rc, char *element);
+void generic_src_dst_check(AS_t rc, sg_netcard_t src, sg_netcard_t dst);
 
 /* ************************************************************************** */
 /* *************************** FLOYD ROUTING ******************************** */
 
 /* ************************************************************************** */
 /* *************************** FLOYD ROUTING ******************************** */
-XBT_PRIVATE AS_t model_floyd_create(void);  /* create structures for floyd routing model */
 XBT_PRIVATE void model_floyd_parse_route(AS_t rc, sg_platf_route_cbarg_t route);
 
 XBT_PRIVATE void model_floyd_parse_route(AS_t rc, sg_platf_route_cbarg_t route);
 
-/* ************************************************** */
-/* **************  Cluster ROUTING   **************** */
-
-XBT_PRIVATE surf_As *model_cluster_create(void);      /* create structures for cluster routing model */
-XBT_PRIVATE surf_As *model_torus_cluster_create(void);
-XBT_PRIVATE surf_As *model_fat_tree_cluster_create(void);
-
-/* ************************************************** */
-/* **************  Vivaldi ROUTING   **************** */
-XBT_PRIVATE AS_t model_vivaldi_create(void);      /* create structures for vivaldi routing model */
 #define HOST_PEER(peername) bprintf("peer_%s", peername)
 #define ROUTER_PEER(peername) bprintf("router_%s", peername)
 #define LINK_PEER(peername) bprintf("link_%s", peername)
 
 /* ************************************************************************** */
 /* ********** Dijkstra & Dijkstra Cached ROUTING **************************** */
 #define HOST_PEER(peername) bprintf("peer_%s", peername)
 #define ROUTER_PEER(peername) bprintf("router_%s", peername)
 #define LINK_PEER(peername) bprintf("link_%s", peername)
 
 /* ************************************************************************** */
 /* ********** Dijkstra & Dijkstra Cached ROUTING **************************** */
-XBT_PRIVATE AS_t model_dijkstra_both_create(int cached);    /* create by calling dijkstra or dijkstracache */
-XBT_PRIVATE AS_t model_dijkstra_create(void);       /* create structures for dijkstra routing model */
-XBT_PRIVATE AS_t model_dijkstracache_create(void);  /* create structures for dijkstracache routing model */
 XBT_PRIVATE void model_dijkstra_both_parse_route (AS_t rc, sg_platf_route_cbarg_t route);
 XBT_PRIVATE void model_dijkstra_both_parse_route (AS_t rc, sg_platf_route_cbarg_t route);
-
-/* ************************************************************************** */
-/* *************************** FULL ROUTING ********************************* */
-XBT_PRIVATE AS_t model_full_create(void);   /* create structures for full routing model */
 XBT_PRIVATE void model_full_set_route(  /* Set the route and ASroute between src and dst */
     AS_t rc, sg_platf_route_cbarg_t route);
 /* ************************************************************************** */
 XBT_PRIVATE void model_full_set_route(  /* Set the route and ASroute between src and dst */
     AS_t rc, sg_platf_route_cbarg_t route);
 /* ************************************************************************** */
index d6a5f90..69899fc 100644 (file)
@@ -22,11 +22,6 @@ static XBT_INLINE double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dyn
   return (src_coord-dst_coord)*(src_coord-dst_coord);
 }
 
   return (src_coord-dst_coord)*(src_coord-dst_coord);
 }
 
-AS_t model_vivaldi_create(void)
-{
-  return new simgrid::surf::AsVivaldi();
-}
-
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {