X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f10c9f64beca3d0c8c10fc04ab4b8044000631d4..b99f784b5bc219788376c65e06fe86b943353b0a:/src/surf/surf_routing_cluster_fat_tree.cpp diff --git a/src/surf/surf_routing_cluster_fat_tree.cpp b/src/surf/surf_routing_cluster_fat_tree.cpp index 99232af44f..066cd0fdee 100644 --- a/src/surf/surf_routing_cluster_fat_tree.cpp +++ b/src/surf/surf_routing_cluster_fat_tree.cpp @@ -8,6 +8,11 @@ +AS_t model_fat_tree_cluster_create(void) +{ + return new AsClusterFatTree(); +} + AsClusterFatTree::AsClusterFatTree() : levels(0) {} AsClusterFatTree::~AsClusterFatTree() { @@ -30,6 +35,7 @@ bool AsClusterFatTree::isInSubTree(FatTreeNode *root, FatTreeNode *node) { } return true; } + void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, @@ -39,12 +45,13 @@ void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src, source = this->nodes.find(src->getId())->second; destination = this->nodes.find(dst->getId())->second; - int d, k; // as in d-mod-k + currentNode = source; // up part while (!isInSubTree(currentNode, destination)) { + int d, k; // as in d-mod-k d = destination->position; for (unsigned int i = 0 ; i < currentNode->level ; i++) { @@ -67,7 +74,7 @@ void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src, destination->label[currentNode->level]) { route.push_back(currentNode->children[i]->downLink); if(latency) { - *latency += currentNode->children[d]->downLink->getLatency(); + *latency += currentNode->children[i]->downLink->getLatency(); } currentNode = currentNode->children[i]->downNode; } @@ -148,7 +155,7 @@ void AsClusterFatTree::generateSwitches() { } - if(this->nodesByLevel[0] < this->nodes.size()) { + if(this->nodesByLevel[0] > this->nodes.size()) { surf_parse_error("There is not enough nodes to fit to the described topology." " Please check your platform description (We need %d nodes, we only got %zu)", this->nodesByLevel[0], this->nodes.size()); @@ -236,14 +243,13 @@ int AsClusterFatTree::getLevelPosition(const unsigned int level) { return tempPosition; } -void AsClusterFatTree::addComputeNodes(std::vector const& id) { +void AsClusterFatTree::addComputeNode(int id) { using std::make_pair; + static int position = 0; FatTreeNode* newNode; - for (size_t i = 0 ; i < id.size() ; i++) { - newNode = new FatTreeNode(id[i], 0, i); - newNode->parents.resize(this->upperLevelNodesNumber[0] * this->lowerLevelPortsNumber[i]); - this->nodes.insert(make_pair(id[i],newNode)); - } + newNode = new FatTreeNode(id, 0, position); + newNode->parents.resize(this->upperLevelNodesNumber[0] * this->lowerLevelPortsNumber[0]); + this->nodes.insert(make_pair(id,newNode)); } void AsClusterFatTree::addLink(sg_platf_cluster_cbarg_t cluster, @@ -276,7 +282,7 @@ void AsClusterFatTree::parse_specific_arguments(sg_platf_cluster_cbarg_t } // The first parts of topo_parameters should be the levels number - this->levels = std::atoi(tmp[0].c_str()); // stoi() only in C++11... + this->levels = std::atoi(parameters[0].c_str()); // stoi() only in C++11... // Then, a l-sized vector standing for the childs number by level boost::split(tmp, parameters[1], boost::is_any_of(","));