-/* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2014-2020. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
{
}
-void DragonflyZone::rankId_to_coords(int rankId, unsigned int coords[4])
+void DragonflyZone::rankId_to_coords(int rankId, unsigned int coords[4]) const
{
// coords : group, chassis, blade, node
coords[0] = rankId / (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
this->routers_.emplace_back(i, j, k);
}
-void DragonflyZone::create_link(const std::string& id, int numlinks, resource::LinkImpl** linkup,
- resource::LinkImpl** linkdown)
+void DragonflyZone::generate_link(const std::string& id, int numlinks, resource::LinkImpl** linkup,
+ resource::LinkImpl** linkdown) const
{
*linkup = nullptr;
*linkdown = nullptr;
LinkCreationArgs linkTemplate;
- linkTemplate.bandwidth = this->bw_ * numlinks;
+ linkTemplate.bandwidths.push_back(this->bw_ * numlinks);
linkTemplate.latency = this->lat_;
linkTemplate.policy = this->sharing_policy_;
linkTemplate.id = std::move(id);
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_" +
std::to_string(j / num_links_per_link_) + "_" + std::to_string(uniqueId);
- this->create_link(id, 1, &linkup, &linkdown);
+ this->generate_link(id, 1, &linkup, &linkdown);
this->routers_[i].my_nodes_[j] = linkup;
if (this->sharing_policy_ == s4u::Link::SharingPolicy::SPLITDUPLEX)
for (unsigned int k = j + 1; k < this->num_blades_per_chassis_; k++) {
std::string id = "green_link_in_chassis_" + std::to_string(i % num_chassis_per_group_) + "_between_routers_" +
std::to_string(j) + "_and_" + std::to_string(k) + "_" + std::to_string(uniqueId);
- this->create_link(id, this->num_links_green_, &linkup, &linkdown);
+ this->generate_link(id, this->num_links_green_, &linkup, &linkdown);
this->routers_[i * num_blades_per_chassis_ + j].green_links_[k] = linkup;
this->routers_[i * num_blades_per_chassis_ + k].green_links_[j] = linkdown;
for (unsigned int l = 0; l < this->num_blades_per_chassis_; l++) {
std::string id = "black_link_in_group_" + std::to_string(i) + "_between_chassis_" + std::to_string(j) +
"_and_" + std::to_string(k) +"_blade_" + std::to_string(l) + "_" + std::to_string(uniqueId);
- this->create_link(id, this->num_links_black_, &linkup, &linkdown);
+ this->generate_link(id, this->num_links_black_, &linkup, &linkdown);
this->routers_[i * num_blades_per_chassis_ * num_chassis_per_group_ + j * num_blades_per_chassis_ + l]
.black_links_[k] = linkup;
unsigned int routernumj = j * num_blades_per_chassis_ * num_chassis_per_group_ + i;
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->create_link(id, this->num_links_blue_, &linkup, &linkdown);
+ this->generate_link(id, this->num_links_blue_, &linkup, &linkdown);
this->routers_[routernumi].blue_link_ = linkup;
this->routers_[routernumj].blue_link_ = linkdown;
}
if (targetRouter != myRouter) {
-
// are we on a different group ?
if (targetRouter->group_ != currentRouter->group_) {
// go to the router of our group connected to this one.