Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fat trees progress
authorStéphane Castelli <stephane.castelli@loria.fr>
Thu, 17 Apr 2014 11:39:36 +0000 (13:39 +0200)
committerStéphane Castelli <stephane.castelli@loria.fr>
Thu, 17 Apr 2014 11:39:36 +0000 (13:39 +0200)
src/surf/surf_routing_cluster_fat_tree.cpp
src/surf/surf_routing_cluster_fat_tree.hpp

index 5057c98..cd543a3 100644 (file)
@@ -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<int> const& id) {
index 7aaf9b1..1430c43 100644 (file)
@@ -65,8 +65,8 @@ public:
 protected:
   //description of a PGFT (TODO : better doc)
   unsigned int levels;
-  std::vector<int> lowerLevelNodesNumber;
-  std::vector<int> upperLevelNodesNumber;
+  std::vector<int> lowerLevelNodesNumber; // number of children by node
+  std::vector<int> upperLevelNodesNumber; // number of parents by node
   std::vector<int> lowerLevelPortsNumber;
   
   std::vector<FatTreeNode*> nodes;
@@ -74,6 +74,6 @@ protected:
   std::vector<unsigned int> 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