Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
give a network_model to each NetZone (unused for now)
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 8 Jul 2018 23:17:58 +0000 (01:17 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 9 Jul 2018 04:46:40 +0000 (06:46 +0200)
For now, it cannot be anything else than the network_model of the
englobing zone, or the global surf_network_model for the root zone.

For now, it's not used anywhere.

Of course, the goal is to finally implement this multi-model shit.

24 files changed:
include/simgrid/forward.h
include/simgrid/kernel/routing/ClusterZone.hpp
include/simgrid/kernel/routing/DijkstraZone.hpp
include/simgrid/kernel/routing/DragonflyZone.hpp
include/simgrid/kernel/routing/EmptyZone.hpp
include/simgrid/kernel/routing/FatTreeZone.hpp
include/simgrid/kernel/routing/FloydZone.hpp
include/simgrid/kernel/routing/FullZone.hpp
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/kernel/routing/RoutedZone.hpp
include/simgrid/kernel/routing/TorusZone.hpp
include/simgrid/kernel/routing/VivaldiZone.hpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/EmptyZone.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/RoutedZone.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/surf/sg_platf.cpp

index 601cb74..58f1625 100644 (file)
@@ -94,6 +94,7 @@ namespace resource {
 class Action;
 class Model;
 class Resource;
+class NetworkModel;
 class TraceEvent;
 class LinkImpl;
 class NetworkAction;
index c3135dc..167b2c1 100644 (file)
@@ -67,7 +67,7 @@ namespace routing {
 
 class ClusterZone : public NetZoneImpl {
 public:
-  explicit ClusterZone(NetZoneImpl* father, std::string name);
+  explicit ClusterZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
   void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
index e06f0fb..9c5e2c5 100644 (file)
@@ -24,7 +24,7 @@ namespace routing {
  */
 class XBT_PRIVATE DijkstraZone : public RoutedZone {
 public:
-  DijkstraZone(NetZoneImpl* father, std::string name, bool cached);
+  DijkstraZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel, bool cached);
   void seal() override;
 
   ~DijkstraZone() override;
index c300f7a..dfd6bf2 100644 (file)
@@ -61,7 +61,7 @@ public:
  */
 class XBT_PUBLIC DragonflyZone : public ClusterZone {
 public:
-  explicit DragonflyZone(NetZoneImpl* father, std::string name);
+  explicit DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
   ~DragonflyZone() override;
   //      void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
index b015de0..f193f27 100644 (file)
@@ -21,7 +21,7 @@ namespace routing {
 
 class XBT_PRIVATE EmptyZone : public NetZoneImpl {
 public:
-  explicit EmptyZone(NetZoneImpl* father, std::string name);
+  explicit EmptyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
   ~EmptyZone() override;
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override
index e39ef33..da365f7 100644 (file)
@@ -98,7 +98,7 @@ public:
  */
 class XBT_PRIVATE FatTreeZone : public ClusterZone {
 public:
-  explicit FatTreeZone(NetZoneImpl* father, std::string name);
+  explicit FatTreeZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
   ~FatTreeZone() override;
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
 
index 172c694..d225bb6 100644 (file)
@@ -23,7 +23,7 @@ namespace routing {
  */
 class XBT_PRIVATE FloydZone : public RoutedZone {
 public:
-  explicit FloydZone(NetZoneImpl* father, std::string name);
+  explicit FloydZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
   ~FloydZone() override;
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
index bbf16f6..7a9e84d 100644 (file)
@@ -20,7 +20,7 @@ namespace routing {
  */
 class XBT_PRIVATE FullZone : public RoutedZone {
 public:
-  explicit FullZone(NetZoneImpl* father, std::string name);
+  explicit FullZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
   void seal() override;
   ~FullZone() override;
 
index 9e80905..260661c 100644 (file)
@@ -51,7 +51,7 @@ class XBT_PUBLIC NetZoneImpl {
   friend simgrid::kernel::EngineImpl; // it destroys netRoot_
 
 protected:
-  explicit NetZoneImpl(NetZoneImpl* father, std::string name);
+  explicit NetZoneImpl(NetZoneImpl* father, std::string name, resource::NetworkModel* network_model);
   virtual ~NetZoneImpl();
 
 public:
@@ -86,6 +86,9 @@ protected:
   bool get_bypass_route(routing::NetPoint* src, routing::NetPoint* dst,
                         /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
 
+public:
+  resource::NetworkModel* network_model_;
+
 private:
   s4u::NetZone piface_;
 
index 0d19377..46c6518 100644 (file)
@@ -50,7 +50,7 @@ namespace routing {
 
 class XBT_PRIVATE RoutedZone : public NetZoneImpl {
 public:
-  explicit RoutedZone(NetZoneImpl* father, std::string name);
+  explicit RoutedZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
 
   void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
                  std::map<std::string, xbt_edge_t>* edges) override;
index 29e9855..eed582c 100644 (file)
@@ -21,7 +21,7 @@ namespace routing {
 
 class XBT_PRIVATE TorusZone : public ClusterZone {
 public:
-  explicit TorusZone(NetZoneImpl* father, std::string name);
+  explicit TorusZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
   void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position) override;
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
   void parse_specific_arguments(ClusterCreationArgs* cluster) override;
index 873eddd..820ff10 100644 (file)
@@ -46,7 +46,7 @@ namespace routing {
 
 class XBT_PRIVATE VivaldiZone : public ClusterZone {
 public:
-  explicit VivaldiZone(NetZoneImpl* father, std::string name);
+  explicit VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
 
   void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
index 500a1d1..24741b5 100644 (file)
@@ -17,7 +17,10 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"
 namespace simgrid {
 namespace kernel {
 namespace routing {
-ClusterZone::ClusterZone(NetZoneImpl* father, std::string name) : NetZoneImpl(father, name) {}
+ClusterZone::ClusterZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : NetZoneImpl(father, name, netmodel)
+{
+}
 
 void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
 {
index 1c58336..37cd82d 100644 (file)
@@ -26,8 +26,8 @@ public:
   int graph_id_ = -1; /* used for caching internal graph id's */
 };
 
-DijkstraZone::DijkstraZone(NetZoneImpl* father, std::string name, bool cached)
-    : RoutedZone(father, name), cached_(cached)
+DijkstraZone::DijkstraZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel, bool cached)
+    : RoutedZone(father, name, netmodel), cached_(cached)
 {
 }
 
index a5a268d..34b4513 100644 (file)
@@ -18,7 +18,10 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-DragonflyZone::DragonflyZone(NetZoneImpl* father, std::string name) : ClusterZone(father, name) {}
+DragonflyZone::DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : ClusterZone(father, name, netmodel)
+{
+}
 
 DragonflyZone::~DragonflyZone()
 {
index a50a06c..6405f27 100644 (file)
@@ -15,7 +15,10 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-EmptyZone::EmptyZone(NetZoneImpl* father, std::string name) : NetZoneImpl(father, name) {}
+EmptyZone::EmptyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : NetZoneImpl(father, name, netmodel)
+{
+}
 
 EmptyZone::~EmptyZone() = default;
 
index 917b40d..f907679 100644 (file)
@@ -22,7 +22,8 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-FatTreeZone::FatTreeZone(NetZoneImpl* father, std::string name) : ClusterZone(father, name)
+FatTreeZone::FatTreeZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : ClusterZone(father, name, netmodel)
 {
   XBT_DEBUG("Creating a new fat tree.");
 }
index 57e7ffd..1b403b1 100644 (file)
@@ -22,7 +22,8 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-FloydZone::FloydZone(NetZoneImpl* father, std::string name) : RoutedZone(father, name)
+FloydZone::FloydZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : RoutedZone(father, name, netmodel)
 {
   predecessor_table_ = nullptr;
   cost_table_        = nullptr;
index 765e13e..3c1e648 100644 (file)
@@ -16,7 +16,10 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 namespace simgrid {
 namespace kernel {
 namespace routing {
-FullZone::FullZone(NetZoneImpl* father, std::string name) : RoutedZone(father, name) {}
+FullZone::FullZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : RoutedZone(father, name, netmodel)
+{
+}
 
 void FullZone::seal()
 {
index 9f5d38a..bdc9a7e 100644 (file)
@@ -26,7 +26,8 @@ public:
   std::vector<resource::LinkImpl*> links;
 };
 
-NetZoneImpl::NetZoneImpl(NetZoneImpl* father, std::string name) : piface_(this), father_(father), name_(name)
+NetZoneImpl::NetZoneImpl(NetZoneImpl* father, std::string name, resource::NetworkModel* network_model)
+    : network_model_(network_model), piface_(this), father_(father), name_(name)
 {
   xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name.c_str()),
              "Refusing to create a second NetZone called '%s'.", name.c_str());
index db0fb9a..9ff4572 100644 (file)
@@ -59,7 +59,10 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-RoutedZone::RoutedZone(NetZoneImpl* father, std::string name) : NetZoneImpl(father, name) {}
+RoutedZone::RoutedZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : NetZoneImpl(father, name, netmodel)
+{
+}
 
 void RoutedZone::get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
                            std::map<std::string, xbt_edge_t>* edges)
index 7955bd1..a23d1b1 100644 (file)
@@ -29,7 +29,10 @@ inline void rankId_to_coords(int rankId, std::vector<unsigned int> dimensions, u
 namespace simgrid {
 namespace kernel {
 namespace routing {
-TorusZone::TorusZone(NetZoneImpl* father, std::string name) : ClusterZone(father, name) {}
+TorusZone::TorusZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : ClusterZone(father, name, netmodel)
+{
+}
 
 void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position)
 {
index 887cd21..a4a24e3 100644 (file)
@@ -59,7 +59,10 @@ static std::vector<double>* netpoint_get_coords(NetPoint* np)
   return &coords->coords;
 }
 
-VivaldiZone::VivaldiZone(NetZoneImpl* father, std::string name) : ClusterZone(father, name) {}
+VivaldiZone::VivaldiZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+    : ClusterZone(father, name, netmodel)
+{
+}
 
 void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string coord)
 {
index 3343bfc..a5ce276 100644 (file)
@@ -564,36 +564,38 @@ simgrid::kernel::routing::NetZoneImpl* sg_platf_new_Zone_begin(simgrid::kernel::
 
   /* search the routing model */
   simgrid::kernel::routing::NetZoneImpl* new_zone = nullptr;
+  simgrid::kernel::resource::NetworkModel* netmodel =
+      current_routing == nullptr ? surf_network_model : current_routing->network_model_;
   switch (zone->routing) {
     case A_surfxml_AS_routing_Cluster:
-      new_zone = new simgrid::kernel::routing::ClusterZone(current_routing, zone->id);
+      new_zone = new simgrid::kernel::routing::ClusterZone(current_routing, zone->id, netmodel);
       break;
     case A_surfxml_AS_routing_ClusterDragonfly:
-      new_zone = new simgrid::kernel::routing::DragonflyZone(current_routing, zone->id);
+      new_zone = new simgrid::kernel::routing::DragonflyZone(current_routing, zone->id, netmodel);
       break;
     case A_surfxml_AS_routing_ClusterTorus:
-      new_zone = new simgrid::kernel::routing::TorusZone(current_routing, zone->id);
+      new_zone = new simgrid::kernel::routing::TorusZone(current_routing, zone->id, netmodel);
       break;
     case A_surfxml_AS_routing_ClusterFatTree:
-      new_zone = new simgrid::kernel::routing::FatTreeZone(current_routing, zone->id);
+      new_zone = new simgrid::kernel::routing::FatTreeZone(current_routing, zone->id, netmodel);
       break;
     case A_surfxml_AS_routing_Dijkstra:
-      new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, false);
+      new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, netmodel, false);
       break;
     case A_surfxml_AS_routing_DijkstraCache:
-      new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, true);
+      new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, netmodel, true);
       break;
     case A_surfxml_AS_routing_Floyd:
-      new_zone = new simgrid::kernel::routing::FloydZone(current_routing, zone->id);
+      new_zone = new simgrid::kernel::routing::FloydZone(current_routing, zone->id, netmodel);
       break;
     case A_surfxml_AS_routing_Full:
-      new_zone = new simgrid::kernel::routing::FullZone(current_routing, zone->id);
+      new_zone = new simgrid::kernel::routing::FullZone(current_routing, zone->id, netmodel);
       break;
     case A_surfxml_AS_routing_None:
-      new_zone = new simgrid::kernel::routing::EmptyZone(current_routing, zone->id);
+      new_zone = new simgrid::kernel::routing::EmptyZone(current_routing, zone->id, netmodel);
       break;
     case A_surfxml_AS_routing_Vivaldi:
-      new_zone = new simgrid::kernel::routing::VivaldiZone(current_routing, zone->id);
+      new_zone = new simgrid::kernel::routing::VivaldiZone(current_routing, zone->id, netmodel);
       break;
     default:
       xbt_die("Not a valid model!");