Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
96ba5c97d0508131711d08cbfab7b7dcb5a95955
[simgrid.git] / src / surf / surf_routing_cluster_fat_tree.hpp
1 /* Copyright (c) 2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "surf_routing_cluster.hpp"
8
9 #ifndef SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
10 #define SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
11
12
13 /* The class AsClusterFatTree describes PGFT, as introduced by Eitan Zahavi
14  * in "D-Mod-K Routing Providing Non-Blocking Traffic for Shift Permutations
15  * on Real Life Fat Trees" (2010). RLFT are PGFT with some restrictions to 
16  * address real world constraints, which are not currently enforced (but it 
17  * should certainly be checked for)
18  */
19
20 class FatTreeNode {
21 public:
22   int id; // ID as given by the user
23   int level; // The 0th level represents the leafs of the PGFT
24   int position; // Position in the level
25   
26   /* We can see the sizes sum of the two following vectors as the device 
27    * ports number. If we use the notations used in Zahavi's paper, 
28    * children.size() = m_level and parents.size() = w_(level+1)
29    * 
30    */
31   std::vector<FatTreeNode*> children;  // m, apply from lvl 0 to levels - 1 
32   std::vector<FatTreeNode*> parents; // w, apply from lvl 1 to levels
33   FatTreeNode(int id, int level=-1, int position=-1);
34 };
35
36 class FatTreeLink {
37 private:
38   unsigned int ports;
39   std::vector<NetworkLink> linksUp; // From source to destination
40   std::vector<NetworkLink> linksDown; // From destination to source
41   FatTreeNode source;
42   FatTreeNode destination;
43 public:
44   FatTreeLink(int source, int destination, unsigned int ports = 0);
45   NetworkLink getLink(int number = 0) const;
46 };
47
48 class AsClusterFatTree : public AsCluster {
49 public:
50   AsClusterFatTree();
51   ~AsClusterFatTree();
52   virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency) const;
53   virtual void create_links(sg_platf_cluster_cbarg_t cluster);
54   void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster);
55   void addNodes(std::vector<int> const& id);
56   void generateDotFile(string filename = "fatTree.dot");
57
58 protected:
59   //description of a PGFT (TODO : better doc)
60   unsigned int levels;
61   std::vector<int> lowerLevelNodesNumber;
62   std::vector<int> upperLevelNodesNumber;
63   std::vector<int> lowerLevelPortsNumber;
64   
65   std::vector<FatTreeNode*> nodes;
66   std::map<std::pair<int,int>, FatTreeLink*> links;
67   
68 };
69
70
71   
72 #endif