X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/20984b0bb3a1e3e5e213963d9182b1c15baba23c..fc66c4b355619478b469a54fd5d3dfe77b9f4049:/src/surf/surf_routing_cluster_fat_tree.hpp diff --git a/src/surf/surf_routing_cluster_fat_tree.hpp b/src/surf/surf_routing_cluster_fat_tree.hpp index 96ba5c97d0..c4de13f1a7 100644 --- a/src/surf/surf_routing_cluster_fat_tree.hpp +++ b/src/surf/surf_routing_cluster_fat_tree.hpp @@ -17,56 +17,98 @@ * should certainly be checked for) */ +/* TODO : limiter link ? Loopback? + * + */ +class FatTreeNode; +class FatTreeLink; + +/* \class FatTreeNode + * \brief A node in a fat tree + */ class FatTreeNode { public: - int id; // ID as given by the user - int level; // The 0th level represents the leafs of the PGFT - int position; // Position in the level - - /* We can see the sizes sum of the two following vectors as the device - * ports number. If we use the notations used in Zahavi's paper, - * children.size() = m_level and parents.size() = w_(level+1) - * + /* \brief Unique ID which identifies every node + */ + int id; + /* \brief Level into the tree, with 0 being the leafs + */ + unsigned int level; + /* \brief Position into the level, starting from 0 + */ + unsigned int position; + /* In order to link nodes between them, each one must be assigned a label, + * consisting of l integers, l being the levels number of the tree. Each label + * is unique in the level, and the way it is generated allows the construction + * of a fat tree which fits the desired topology + */ + std::vector label; + + /* Links to the lower level, where the position in the vector corresponds to + * a port number. */ - std::vector children; // m, apply from lvl 0 to levels - 1 - std::vector parents; // w, apply from lvl 1 to levels - FatTreeNode(int id, int level=-1, int position=-1); + std::vector children; + /* Links to the upper level, where the position in the vector corresponds to + * a port number. + */ + std::vector parents; + + NetworkLink* limiterLink; + NetworkLink* loopback; + FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, + int position); }; class FatTreeLink { -private: - unsigned int ports; - std::vector linksUp; // From source to destination - std::vector linksDown; // From destination to source - FatTreeNode source; - FatTreeNode destination; public: - FatTreeLink(int source, int destination, unsigned int ports = 0); - NetworkLink getLink(int number = 0) const; + FatTreeLink(sg_platf_cluster_cbarg_t cluster, FatTreeNode *source, + FatTreeNode *destination); + /* Links are dependant of the chosen network model, but must implement + * NetworkLink + */ + NetworkLink *upLink; + NetworkLink *downLink; + FatTreeNode *upNode; + FatTreeNode *downNode; }; class AsClusterFatTree : public AsCluster { public: AsClusterFatTree(); ~AsClusterFatTree(); - virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency) const; - virtual void create_links(sg_platf_cluster_cbarg_t cluster); + virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, + sg_platf_route_cbarg_t into, + double *latency); + // virtual void getRouteAndLatency(const int src, const int dst, + // std::vector *route, + // double *latency) const; + virtual void create_links(); void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster); - void addNodes(std::vector const& id); - void generateDotFile(string filename = "fatTree.dot"); + void addProcessingNode(int id); + void generateDotFile(const string& filename = "fatTree.dot") const; -protected: +private: + //description of a PGFT (TODO : better doc) unsigned int levels; - std::vector lowerLevelNodesNumber; - std::vector upperLevelNodesNumber; - std::vector lowerLevelPortsNumber; + std::vector lowerLevelNodesNumber; // number of children by node + std::vector upperLevelNodesNumber; // number of parents by node + std::vector lowerLevelPortsNumber; // ports between each level l and l-1 + std::map computeNodes; std::vector nodes; - std::map, FatTreeLink*> links; - -}; + std::vector links; + std::vector nodesByLevel; + sg_platf_cluster_cbarg_t cluster; - + void addLink(FatTreeNode *parent, unsigned int parentPort, + FatTreeNode *child, unsigned int childPort); + int getLevelPosition(const unsigned int level); + void generateLabels(); + void generateSwitches(); + int connectNodeToParents(FatTreeNode *node); + bool areRelated(FatTreeNode *parent, FatTreeNode *child); + bool isInSubTree(FatTreeNode *root, FatTreeNode *node); +}; #endif