From: Stéphane Castelli Date: Thu, 17 Apr 2014 11:39:36 +0000 (+0200) Subject: Fat trees progress X-Git-Tag: v3_11~109 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/750a10299dfb858b9b7ce14714fac19f5af9483d Fat trees progress --- diff --git a/src/surf/surf_routing_cluster_fat_tree.cpp b/src/surf/surf_routing_cluster_fat_tree.cpp index 5057c98ba9..cd543a3ab1 100644 --- a/src/surf/surf_routing_cluster_fat_tree.cpp +++ b/src/surf/surf_routing_cluster_fat_tree.cpp @@ -62,15 +62,23 @@ void AsClusterFatTree::create_links(sg_platf_cluster_cbarg_t cluster) { for (unsigned int j = 0 ; j < this->nodesByLevel[i] ; j++) { this->nodes[k]->level = i; this->nodes[k]->position = j; + if(i != 0) { + int position, size; + this->getLevelPosition(i - 1, &position, &size); // TODO : check position and size ? + for (unsigned int l = this->upperLevelNodesNumber[i] * j ; + l < this->upperLevelNodesNumber[i] * (j + 1) ; l++) + this->addLink(this->nodes[position + l], this->nodes[k]); + } + k++; } } } -void AsClusterFatTree::getLevelPosition(const unsigned int level, int &position, int &size) { +void AsClusterFatTree::getLevelPosition(const unsigned int level, int *position, int *size) { if (level > this->levels - 1) { - position = -1; - size = -1; + *position = -1; + *size = -1; return; } int tempPosition = 0; @@ -78,8 +86,8 @@ void AsClusterFatTree::getLevelPosition(const unsigned int level, int &position for (unsigned int i = 0 ; i < level ; i++) { tempPosition += this->nodesByLevel[i]; } - position = tempPosition; - size = this->nodesByLevel[level]; + *position = tempPosition; + *size = this->nodesByLevel[level]; } void AsClusterFatTree::addNodes(std::vector const& id) { diff --git a/src/surf/surf_routing_cluster_fat_tree.hpp b/src/surf/surf_routing_cluster_fat_tree.hpp index 7aaf9b1f30..1430c43bfb 100644 --- a/src/surf/surf_routing_cluster_fat_tree.hpp +++ b/src/surf/surf_routing_cluster_fat_tree.hpp @@ -65,8 +65,8 @@ public: protected: //description of a PGFT (TODO : better doc) unsigned int levels; - std::vector lowerLevelNodesNumber; - std::vector upperLevelNodesNumber; + std::vector lowerLevelNodesNumber; // number of children by node + std::vector upperLevelNodesNumber; // number of parents by node std::vector lowerLevelPortsNumber; std::vector nodes; @@ -74,6 +74,6 @@ protected: std::vector nodesByLevel; void addLink(FatTreeNode *parent, FatTreeNode *child); - void getLevelPosition(const unsigned int level, int &position, int &size); + void getLevelPosition(const unsigned int level, int *position, int *size); }; #endif