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) {
31 void AsClusterFatTree::parse_specific_arguments(sg_platf_cluster_cbarg_t
33 std::vector<string> parameters;
34 std::vector<string> tmp;
35 boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
37 if (parameters.size() != 4){
38 surf_parse_error("Fat trees are defined by the levels number and 3 vectors"
39 ", see the documentation for more informations");
40 // Well, there's no doc, yet
43 // The first parts of topo_parameters should be the levels number
44 this->levels = std::atoi(tmp[0].c_str());
46 // Then, a l-sized vector standing for the childs number by level
47 boost::split(tmp, parameters[1], boost::is_any_of(","));
48 if(tmp.size() != this->levels) {
49 surf_parse_error("Fat trees are defined by the levels number and 3 vectors"
50 ", see the documentation for more informations");
52 for(unsigned int i = 0 ; i < tmp.size() ; i++){
53 this->lowerLevelNodesNumber.push_back(std::atoi(tmp[i].c_str()));
56 // Then, a l-sized vector standing for the parents number by level
57 boost::split(tmp, parameters[2], boost::is_any_of(","));
58 if(tmp.size() != this->levels) {
59 surf_parse_error("Fat trees are defined by the levels number and 3 vectors"
60 ", see the documentation for more informations");
62 for(unsigned int i = 0 ; i < tmp.size() ; i++){
63 this->upperLevelNodesNumber.push_back(std::atoi(tmp[i].c_str()));
66 // Finally, a l-sized vector standing for the ports number with the lower level
67 boost::split(tmp, parameters[3], boost::is_any_of(","));
68 if(tmp.size() != this->levels) {
69 surf_parse_error("Fat trees are defined by the levels number and 3 vectors"
70 ", see the documentation for more informations");
73 for(unsigned int i = 0 ; i < tmp.size() ; i++){
74 this->lowerLevelPortsNumber.push_back(std::atoi(tmp[i].c_str()));