Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a name conflict in Zones. No idea why gcc didn't complain about it
[simgrid.git] / src / kernel / routing / DragonflyZone.cpp
index fd526d16b19912f1808ba1bdff3ef8c693b37f47..ac7d23d70d163fd42d8dca800717e650d6342055 100644 (file)
@@ -1,4 +1,4 @@
-/* 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. */
@@ -23,7 +23,7 @@ DragonflyZone::DragonflyZone(NetZoneImpl* father, const std::string& name, resou
 {
 }
 
-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_);
@@ -132,13 +132,13 @@ void DragonflyZone::generate_routers()
         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);
@@ -173,7 +173,7 @@ void DragonflyZone::generate_links()
     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)
@@ -189,7 +189,7 @@ void DragonflyZone::generate_links()
       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;
@@ -205,7 +205,7 @@ void DragonflyZone::generate_links()
         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;
@@ -226,7 +226,7 @@ void DragonflyZone::generate_links()
       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;
@@ -280,7 +280,6 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
   }
 
   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.