1 #include "surf_routing_cluster_fat_tree.hpp"
3 #include <boost/algorithm/string/split.hpp>
4 #include <boost/algorithm/string/classification.hpp>
7 AsClusterFatTree::AsClusterFatTree() : levels(0) {}
11 void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src,
13 sg_platf_route_cbarg_t into,
18 void AsClusterFatTree::create_links() {
19 if(this->levels == 0) {
23 // for (unsigned int i = 0 ; i < this->levels)
29 void AsClusterFatTree::parse_specific_arguments(sg_platf_cluster_cbarg_t
31 std::vector<string> parameters;
32 std::vector<string> tmp;
33 boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
35 if (parameters.size() != 4){
36 surf_parse_error("Fat trees are defined by the levels number et 3 vectors,"
37 " see the documentation for more informations");
38 // Well, there's no doc, yet
41 // The first parts of topo_parameters should be the levels number
42 this->levels = std::atoi(tmp[0].c_str());
44 // Then, a l-sized vector standing for the childs number by level
45 boost::split(tmp, parameters[1], boost::is_any_of(","));
46 if(tmp.size() != this->levels) {
47 surf_parse_error("Fat trees are defined by the levels number et 3 vectors,"
48 " see the documentation for more informations");
50 for(unsigned int i = 0 ; i < tmp.size() ; i++){
51 this->lowerLevelNodesNumber.push_back(std::atoi(tmp[i].c_str()));
54 // Then, a l-sized vector standing for the parents number by level
55 boost::split(tmp, parameters[2], boost::is_any_of(","));
56 if(tmp.size() != this->levels) {
57 surf_parse_error("Fat trees are defined by the levels number et 3 vectors,"
58 " see the documentation for more informations");
60 for(unsigned int i = 0 ; i < tmp.size() ; i++){
61 this->upperLevelNodesNumber.push_back(std::atoi(tmp[i].c_str()));
64 // Finally, a l-sized vector standing for the ports number with the lower level
65 boost::split(tmp, parameters[3], boost::is_any_of(","));
66 if(tmp.size() != this->levels) {
67 surf_parse_error("Fat trees are defined by the levels number et 3 vectors,"
68 " see the documentation for more informations");
71 for(unsigned int i = 0 ; i < tmp.size() ; i++){
72 this->lowerLevelPortsNumber.push_back(std::atoi(tmp[i].c_str()));