+AS_t model_fat_tree_cluster_create(void)
+{
+ return new AsClusterFatTree();
+}
+
AsClusterFatTree::AsClusterFatTree() : levels(0) {}
AsClusterFatTree::~AsClusterFatTree() {
}
return true;
}
+
void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src,
RoutingEdgePtr dst,
sg_platf_route_cbarg_t into,
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++) {
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;
}
}
- 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());
return tempPosition;
}
-void AsClusterFatTree::addComputeNodes(std::vector<int> 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,
}
// 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(","));