1 /* Copyright (c) 2014. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #include "surf_routing_cluster.hpp"
9 #ifndef SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
10 #define SURF_ROUTING_CLUSTER_FAT_TREE_HPP_
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)
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
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)
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);
39 std::vector<NetworkLink> linksUp; // From source to destination
40 std::vector<NetworkLink> linksDown; // From destination to source
42 FatTreeNode destination;
44 FatTreeLink(int source, int destination, unsigned int ports = 0);
45 NetworkLink getLink(int number = 0) const;
48 class AsClusterFatTree : public AsCluster {
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");
59 //description of a PGFT (TODO : better doc)
61 std::vector<int> lowerLevelNodesNumber;
62 std::vector<int> upperLevelNodesNumber;
63 std::vector<int> lowerLevelPortsNumber;
65 std::vector<FatTreeNode*> nodes;
66 std::map<std::pair<int,int>, FatTreeLink*> links;