X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ebbdc928150e0dda1fffe5d4ab6edab9d1981904..ba769a2169c81556edfaf0ee68089fa3a4bad77b:/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 7aaf9b1f30..addb37e2b1 100644 --- a/src/surf/surf_routing_cluster_fat_tree.hpp +++ b/src/surf/surf_routing_cluster_fat_tree.hpp @@ -17,34 +17,42 @@ * should certainly be checked for) */ +/* TODO : limiter link ? Loopback? + * + */ +class FatTreeNode; +class FatTreeLink; + class FatTreeNode { public: - int id; // ID as given by the user, should be unique - int level; // The 0th level represents the leafs of the PGFT - int position; // Position in the level - + int id; + unsigned int level; // The 0th level represents the leafs of the PGFT + unsigned int position; // Position in the level + std::vector label; /* 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) * */ - std::vector children; // m, apply from lvl 0 to levels - 1 - std::vector parents; // w, apply from lvl 1 to levels + 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); }; class FatTreeLink { public: - unsigned int ports; - std::vector linksUp; // From source to destination - std::vector linksDown; // From destination to source - /* As it is symetric, it might as well be first / second instead - * of source / destination + FatTreeLink(sg_platf_cluster_cbarg_t cluster, FatTreeNode *source, + FatTreeNode *destination); + // unsigned int ports; + /* Links are dependant of the chosen network model, but must implement + * NetworkLink */ - FatTreeNode *source; - FatTreeNode *destination; - //FatTreeLink(FatTreeNode *source, FatTreeNode *destination, unsigned int ports = 0); + NetworkLink *upLink; + NetworkLink *downLink; + FatTreeNode *upNode; + FatTreeNode *downNode; + }; class AsClusterFatTree : public AsCluster { @@ -59,21 +67,29 @@ public: // double *latency) const; virtual void create_links(sg_platf_cluster_cbarg_t cluster); void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster); - void addNodes(std::vector const& id); + 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; - void addLink(FatTreeNode *parent, FatTreeNode *child); - void getLevelPosition(const unsigned int level, int &position, int &size); + void addLink(sg_platf_cluster_cbarg_t cluster, + FatTreeNode *parent, unsigned int parentPort, + FatTreeNode *child, unsigned int childPort); + int getLevelPosition(const unsigned int level); + void generateLabels(); + void generateSwitches(); + int connectNodeToParents(sg_platf_cluster_cbarg_t cluster, FatTreeNode *node); + bool areRelated(FatTreeNode *parent, FatTreeNode *child); + bool isInSubTree(FatTreeNode *root, FatTreeNode *node); }; #endif