Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
trimming zones
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Fri, 19 Mar 2021 10:04:26 +0000 (11:04 +0100)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 22 Mar 2021 15:41:54 +0000 (16:41 +0100)
16 files changed:
include/simgrid/kernel/routing/DijkstraZone.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/TorusZone.hpp
include/simgrid/kernel/routing/VivaldiZone.hpp
include/simgrid/kernel/routing/WifiZone.hpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/EmptyZone.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/kernel/routing/WifiZone.cpp

index 91fb35d..6ae3a92 100644 (file)
@@ -23,7 +23,6 @@ namespace routing {
  * long path resolution times.
  */
 class XBT_PRIVATE DijkstraZone : public RoutedZone {
-private:
   static void route_graph_delete(xbt_graph_t);
 
   std::unique_ptr<s_xbt_graph_t, decltype(&DijkstraZone::route_graph_delete)> route_graph_{
@@ -38,7 +37,7 @@ private:
   void do_seal() override;
 
 public:
-  DijkstraZone(const std::string& name, bool cached);
+  DijkstraZone(const std::string& name, bool cached) : RoutedZone(name), cached_(cached) {}
 
   /* For each vertex (node) already in the graph,
    * make sure it also has a loopback link; this loopback
index 2ed304b..77e53dc 100644 (file)
@@ -21,8 +21,8 @@ namespace routing {
 
 class XBT_PRIVATE EmptyZone : public NetZoneImpl {
 public:
-  explicit EmptyZone(const std::string& name);
-  ~EmptyZone() override;
+  explicit EmptyZone(const std::string& name) : NetZoneImpl(name) {}
+  ~EmptyZone() override = default;
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override
   {
index 6b3d881..5412efd 100644 (file)
@@ -97,29 +97,12 @@ public:
  * Routing is made using a destination-mod-k scheme.
  */
 class XBT_PRIVATE FatTreeZone : public ClusterZone {
-public:
-  explicit FatTreeZone(const std::string& name);
-  FatTreeZone(const FatTreeZone&) = delete;
-  FatTreeZone& operator=(const FatTreeZone&) = delete;
-  ~FatTreeZone() override;
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
-
-  /** @brief Read the parameters in topo_parameters field.
-   *
-   * It will also store the cluster for future use.
-   */
-  void parse_specific_arguments(ClusterCreationArgs* cluster) override;
-  void add_processing_node(int id);
-  void generate_dot_file(const std::string& filename = "fat_tree.dot") const;
-
-private:
   /** @brief Generate the fat tree
    *
    * Once all processing nodes have been added, this will make sure the fat
    * tree is generated by calling generateLabels(), generateSwitches() and
    * then connection all nodes between them, using their label.
    */
-  void do_seal() override;
   // description of a PGFT (TODO : better doc)
   unsigned long levels_ = 0;
   std::vector<unsigned int> num_children_per_node_; // number of children by node
@@ -140,6 +123,23 @@ private:
   int connect_node_to_parents(FatTreeNode* node);
   bool are_related(FatTreeNode* parent, FatTreeNode* child) const;
   bool is_in_sub_tree(FatTreeNode* root, FatTreeNode* node) const;
+
+  void do_seal() override;
+
+public:
+  explicit FatTreeZone(const std::string& name) : ClusterZone(name) {}
+  FatTreeZone(const FatTreeZone&) = delete;
+  FatTreeZone& operator=(const FatTreeZone&) = delete;
+  ~FatTreeZone() override;
+  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+
+  /** @brief Read the parameters in topo_parameters field.
+   *
+   * It will also store the cluster for future use.
+   */
+  void parse_specific_arguments(ClusterCreationArgs* cluster) override;
+  void add_processing_node(int id);
+  void generate_dot_file(const std::string& filename = "fat_tree.dot") const;
 };
 } // namespace routing
 } // namespace kernel
index 7601328..8ab9e20 100644 (file)
@@ -22,8 +22,16 @@ namespace routing {
  *  (somewhere between the one of @{DijkstraZone} and the one of @{FullZone}).
  */
 class XBT_PRIVATE FloydZone : public RoutedZone {
+  /* vars to compute the Floyd algorithm. */
+  std::vector<int> predecessor_table_;
+  std::vector<double> cost_table_;
+  std::vector<RouteCreationArgs*> link_table_;
+
+  void init_tables(unsigned int table_size);
+  void do_seal() override;
+
 public:
-  explicit FloydZone(const std::string& name);
+  explicit FloydZone(const std::string& name) : RoutedZone(name) {}
   FloydZone(const FloydZone&) = delete;
   FloydZone& operator=(const FloydZone&) = delete;
   ~FloydZone() override;
@@ -31,15 +39,6 @@ public:
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                  std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
-
-private:
-  /* vars to compute the Floyd algorithm. */
-  std::vector<int> predecessor_table_;
-  std::vector<double> cost_table_;
-  std::vector<RouteCreationArgs*> link_table_;
-
-  void init_tables(unsigned int table_size);
-  void do_seal() override;
 };
 } // namespace routing
 } // namespace kernel
index 7584894..a2c1a8b 100644 (file)
@@ -20,7 +20,7 @@ namespace routing {
  */
 class XBT_PRIVATE FullZone : public RoutedZone {
 public:
-  explicit FullZone(const std::string& name);
+  explicit FullZone(const std::string& name) : RoutedZone(name){};
   FullZone(const FullZone&) = delete;
   FullZone& operator=(const FullZone) = delete;
   ~FullZone() override;
index 4eff9c1..29ea781 100644 (file)
@@ -20,14 +20,13 @@ namespace routing {
  */
 
 class XBT_PRIVATE TorusZone : public ClusterZone {
+  std::vector<unsigned int> dimensions_;
+
 public:
-  explicit TorusZone(const std::string& name);
+  explicit TorusZone(const std::string& name) : ClusterZone(name){};
   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;
-
-private:
-  std::vector<unsigned int> dimensions_;
 };
 } // namespace routing
 } // namespace kernel
index ab0ad8c..bf17c6c 100644 (file)
@@ -46,7 +46,7 @@ namespace routing {
 
 class XBT_PRIVATE VivaldiZone : public ClusterZone {
 public:
-  explicit VivaldiZone(const std::string& name);
+  explicit VivaldiZone(const std::string& name) : ClusterZone(name) {}
 
   void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, const std::string& coord);
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
index e325ca0..272f55e 100644 (file)
@@ -19,20 +19,20 @@ namespace routing {
  *  That link is used for all communications within the zone.
  */
 class XBT_PRIVATE WifiZone : public RoutedZone {
+  resource::LinkImpl* wifi_link_ = nullptr; // Representing the air media (there is no such thing in NS-3)
+  NetPoint* access_point_        = nullptr; // Zone's gateway to the external world
+
+  void do_seal() override;
+
 public:
-  explicit WifiZone(const std::string& name);
+  explicit WifiZone(const std::string& name) : RoutedZone(name){};
   WifiZone(const WifiZone&) = delete;
   WifiZone& operator=(const WifiZone) = delete;
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
   s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths,
                          s4u::Link::SharingPolicy policy) override;
-  NetPoint* get_access_point() { return access_point_; }
-
-private:
-  void do_seal() override;
-  resource::LinkImpl* wifi_link_ = nullptr; // Representing the air media (there is no such thing in NS-3)
-  NetPoint* access_point_        = nullptr; // Zone's gateway to the external world
+  NetPoint* get_access_point() const { return access_point_; }
 };
 } // namespace routing
 } // namespace kernel
index 5471809..0a4c855 100644 (file)
@@ -27,8 +27,6 @@ public:
   int graph_id_ = -1; /* used for caching internal graph id's */
 };
 
-DijkstraZone::DijkstraZone(const std::string& name, bool cached) : RoutedZone(name), cached_(cached) {}
-
 void DijkstraZone::route_graph_delete(xbt_graph_t g)
 {
   xbt_graph_free_graph(
index 8f2b14c..ea70371 100644 (file)
@@ -15,10 +15,6 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-EmptyZone::EmptyZone(const std::string& name) : NetZoneImpl(name) {}
-
-EmptyZone::~EmptyZone() = default;
-
 void EmptyZone::get_graph(const s_xbt_graph_t* /*graph*/, std::map<std::string, xbt_node_t, std::less<>>* /*nodes*/,
                           std::map<std::string, xbt_edge_t, std::less<>>* /*edges*/)
 {
index 9889d4f..0c4ee2f 100644 (file)
@@ -21,19 +21,12 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-FatTreeZone::FatTreeZone(const std::string& name) : ClusterZone(name)
-{
-  XBT_DEBUG("Creating a new fat tree.");
-}
-
 FatTreeZone::~FatTreeZone()
 {
-  for (FatTreeNode const* node : this->nodes_) {
+  for (FatTreeNode const* node : this->nodes_)
     delete node;
-  }
-  for (FatTreeLink const* link : this->links_) {
+  for (FatTreeLink const* link : this->links_)
     delete link;
-  }
 }
 
 bool FatTreeZone::is_in_sub_tree(FatTreeNode* root, FatTreeNode* node) const
index cfd4dab..45b0d65 100644 (file)
@@ -23,8 +23,6 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-FloydZone::FloydZone(const std::string& name) : RoutedZone(name) {}
-
 FloydZone::~FloydZone()
 {
   /* Delete link_table */
index b3138b5..2978471 100644 (file)
@@ -16,7 +16,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 namespace simgrid {
 namespace kernel {
 namespace routing {
-FullZone::FullZone(const std::string& name) : RoutedZone(name) {}
 
 void FullZone::do_seal()
 {
index a31d60d..2a2d218 100644 (file)
@@ -18,7 +18,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster_torus, surf_route_cluster, "T
 namespace simgrid {
 namespace kernel {
 namespace routing {
-TorusZone::TorusZone(const std::string& name) : ClusterZone(name) {}
 
 void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position)
 {
index 4fa3069..76e9883 100644 (file)
@@ -61,8 +61,6 @@ static std::vector<double>* netpoint_get_coords(NetPoint* np)
   return &coords->coords;
 }
 
-VivaldiZone::VivaldiZone(const std::string& name) : ClusterZone(name) {}
-
 void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, const std::string& coord)
 {
   xbt_assert(netpoint->get_englobing_zone() == this,
index 3035640..a6f8bc7 100644 (file)
@@ -16,7 +16,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_wifi, surf, "Routing part of surf");
 namespace simgrid {
 namespace kernel {
 namespace routing {
-WifiZone::WifiZone(const std::string& name) : RoutedZone(name) {}
 
 void WifiZone::do_seal()
 {
@@ -52,6 +51,7 @@ void WifiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
     }
   }
 }
+
 s4u::Link* WifiZone::create_link(const std::string& name, const std::vector<double>& bandwidths,
                                  s4u::Link::SharingPolicy policy)
 {