]> AND Public Git Repository - simgrid.git/blobdiff - include/simgrid/kernel/routing/FatTreeZone.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
NetworkModelIntf: Interface to dynamic factors
[simgrid.git] / include / simgrid / kernel / routing / FatTreeZone.hpp
index 7f064e7107478693744a4687aa499dd344008ce8..75f83730f6bc961e046d273d0cc315a32027b4d1 100644 (file)
@@ -38,11 +38,11 @@ public:
   /** Links to the lower level, where the position in the vector corresponds to
    * a port number.
    */
-  std::vector<FatTreeLink*> children;
+  std::vector<std::shared_ptr<FatTreeLink>> children;
   /** Links to the upper level, where the position in the vector corresponds to
    * a port number.
    */
-  std::vector<FatTreeLink*> parents;
+  std::vector<std::shared_ptr<FatTreeLink>> parents;
 
   /** Virtual link standing for the node global capacity.
    */
@@ -102,7 +102,7 @@ public:
  *
  * Routing is made using a destination-mod-k scheme.
  */
-class XBT_PRIVATE FatTreeZone : public ClusterZone {
+class XBT_PRIVATE FatTreeZone : public ClusterBase {
   /** @brief Generate the fat tree
    *
    * Once all processing nodes have been added, this will make sure the fat
@@ -115,31 +115,26 @@ class XBT_PRIVATE FatTreeZone : public ClusterZone {
   std::vector<unsigned int> num_parents_per_node_;  // number of parents by node
   std::vector<unsigned int> num_port_lower_level_;  // ports between each level l and l-1
 
-  std::map<int, FatTreeNode*> compute_nodes_;
-  std::vector<FatTreeNode*> nodes_;
-  std::vector<FatTreeLink*> links_;
+  std::map<int, std::shared_ptr<FatTreeNode>> compute_nodes_;
+  std::vector<std::shared_ptr<FatTreeNode>> nodes_;
+  std::vector<std::shared_ptr<FatTreeLink>> links_;
   std::vector<unsigned int> nodes_by_level_;
 
-  s4u::Link::SharingPolicy link_sharing_policy_; //!< fat tree links: sharing policy
-  double link_bw_;                               //!< fat tree links: bandwidth
-  double link_lat_;                              //!< fat tree links: latency
-
   void add_link(FatTreeNode* parent, unsigned int parent_port, FatTreeNode* child, unsigned int child_port);
   int get_level_position(const unsigned int level);
+  void generate_switches(const s4u::ClusterCallbacks& set_callbacks);
   void generate_labels();
-  void generate_switches();
   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;
+  bool is_in_sub_tree(const FatTreeNode* root, const FatTreeNode* node) const;
 
   void do_seal() override;
 
 public:
-  using ClusterZone::ClusterZone;
+  explicit FatTreeZone(const std::string& name) : ClusterBase(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;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
 
   /**
    * @brief Parse the topology parameters from string format
@@ -153,9 +148,13 @@ public:
   /** @brief Set FatTree topology */
   void set_topology(unsigned int n_levels, const std::vector<unsigned int>& down_links,
                     const std::vector<unsigned int>& up_links, const std::vector<unsigned int>& link_count);
-  /** @brief Set the characteristics of links inside the Fat Tree zone */
-  void set_link_characteristics(double bw, double lat, s4u::Link::SharingPolicy sharing_policy);
   void add_processing_node(int id, resource::LinkImpl* limiter, resource::LinkImpl* loopback);
+  /**
+   * @brief Build upper levels (switches) in Fat-Tree
+   *
+   * Suppose that set_topology and add_processing_node have already been called
+   */
+  void build_upper_levels(const s4u::ClusterCallbacks& set_callbacks);
   void generate_dot_file(const std::string& filename = "fat_tree.dot") const;
 };
 } // namespace routing