throw std::invalid_argument(std::string("Last parameter is not the amount of nodes per blade:") + parameters[3]);
}
+ this->sharing_policy_ = cluster->sharing_policy;
if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX)
this->num_links_per_link_ = 2;
-
- this->cluster_ = cluster;
+ this->bw_ = cluster->bw;
+ this->lat_ = cluster->lat;
}
/* Generate the cluster once every node is created */
}
}
-void DragonflyZone::createLink(const std::string& id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown)
+void DragonflyZone::createLink(const std::string& id, int numlinks, resource::LinkImpl** linkup,
+ resource::LinkImpl** linkdown)
{
*linkup = nullptr;
*linkdown = nullptr;
LinkCreationArgs linkTemplate;
- linkTemplate.bandwidth = this->cluster_->bw * numlinks;
- linkTemplate.latency = this->cluster_->lat;
- linkTemplate.policy = this->cluster_->sharing_policy; // sthg to do with that ?
+ linkTemplate.bandwidth = this->bw_ * numlinks;
+ linkTemplate.latency = this->lat_;
+ linkTemplate.policy = this->sharing_policy_;
linkTemplate.id = id;
sg_platf_new_link(&linkTemplate);
XBT_DEBUG("Generating link %s", id.c_str());
- surf::LinkImpl* link;
- if (this->cluster_->sharing_policy == SURF_LINK_SPLITDUPLEX) {
- *linkup = surf::LinkImpl::byName(linkTemplate.id + "_UP"); // check link?
- *linkdown = surf::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ?
+ resource::LinkImpl* link;
+ if (this->sharing_policy_ == SURF_LINK_SPLITDUPLEX) {
+ *linkup = resource::LinkImpl::byName(linkTemplate.id + "_UP"); // check link?
+ *linkdown = resource::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ?
} else {
- link = surf::LinkImpl::byName(linkTemplate.id);
+ link = resource::LinkImpl::byName(linkTemplate.id);
*linkup = link;
*linkdown = link;
}
void DragonflyZone::generateLinks()
{
static int uniqueId = 0;
- surf::LinkImpl* linkup;
- surf::LinkImpl* linkdown;
+ resource::LinkImpl* linkup;
+ resource::LinkImpl* linkdown;
unsigned int numRouters = this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_;
// Links from routers to their local nodes.
for (unsigned int i = 0; i < numRouters; i++) {
// allocate structures
- this->routers_[i]->my_nodes_ = new surf::LinkImpl*[num_links_per_link_ * this->num_nodes_per_blade_];
- this->routers_[i]->green_links_ = new surf::LinkImpl*[this->num_blades_per_chassis_];
- this->routers_[i]->black_links_ = new surf::LinkImpl*[this->num_chassis_per_group_];
+ this->routers_[i]->my_nodes_ = new resource::LinkImpl*[num_links_per_link_ * this->num_nodes_per_blade_];
+ this->routers_[i]->green_links_ = new resource::LinkImpl*[this->num_blades_per_chassis_];
+ this->routers_[i]->black_links_ = new resource::LinkImpl*[this->num_chassis_per_group_];
for (unsigned int j = 0; j < num_links_per_link_ * this->num_nodes_per_blade_; j += num_links_per_link_) {
std::string id = "local_link_from_router_" + std::to_string(i) + "_to_node_" +
this->createLink(id, 1, &linkup, &linkdown);
this->routers_[i]->my_nodes_[j] = linkup;
- if (this->cluster_->sharing_policy == SURF_LINK_SPLITDUPLEX)
+ if (this->sharing_policy_ == SURF_LINK_SPLITDUPLEX)
this->routers_[i]->my_nodes_[j + 1] = linkdown;
uniqueId++;
for (unsigned int j = i + 1; j < this->num_groups_; j++) {
unsigned int routernumi = i * num_blades_per_chassis_ * num_chassis_per_group_ + j;
unsigned int routernumj = j * num_blades_per_chassis_ * num_chassis_per_group_ + i;
- this->routers_[routernumi]->blue_links_ = new surf::LinkImpl*;
- this->routers_[routernumj]->blue_links_ = new surf::LinkImpl*;
+ this->routers_[routernumi]->blue_links_ = new resource::LinkImpl*;
+ this->routers_[routernumj]->blue_links_ = new resource::LinkImpl*;
std::string id = "blue_link_between_group_"+ std::to_string(i) +"_and_" + std::to_string(j) +"_routers_" +
std::to_string(routernumi) + "_and_" + std::to_string(routernumj) + "_" + std::to_string(uniqueId);
this->createLink(id, this->num_links_blue_, &linkup, &linkdown);
dst->id());
if ((src->id() == dst->id()) && has_loopback_) {
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos(src->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
route->link_list.push_back(info.first);
if (latency)
*latency += myRouter->my_nodes_[myCoords[3] * num_links_per_link_]->latency();
if (has_limiter_) { // limiter for sender
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
route->link_list.push_back(info.first);
}
}
if (has_limiter_) { // limiter for receiver
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(dst->id()));
+ std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos_with_loopback(dst->id()));
route->link_list.push_back(info.first);
}