Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
DragonflyZone: do not save the whole ClusterCreationArgs structure
[simgrid.git] / src / kernel / routing / DragonflyZone.cpp
index 3ad8df8..a0ada55 100644 (file)
@@ -113,10 +113,11 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
     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 */
@@ -163,14 +164,14 @@ void DragonflyZone::createLink(const std::string& id, int numlinks, surf::LinkIm
   *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) {
+  if (this->sharing_policy_ == SURF_LINK_SPLITDUPLEX) {
     *linkup   = surf::LinkImpl::byName(linkTemplate.id + "_UP");   // check link?
     *linkdown = surf::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ?
   } else {
@@ -201,7 +202,7 @@ void DragonflyZone::generateLinks()
       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++;
@@ -262,18 +263,19 @@ void DragonflyZone::generateLinks()
   }
 }
 
-void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency)
+void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency)
 {
   // Minimal routing version.
   // TODO : non-minimal random one, and adaptive ?
 
-  if (dst->isRouter() || src->isRouter())
+  if (dst->is_router() || src->is_router())
     return;
 
-  XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
+  XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(),
+           dst->id());
 
   if ((src->id() == dst->id()) && has_loopback_) {
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePosition(src->id()));
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos(src->id()));
 
     route->link_list.push_back(info.first);
     if (latency)
@@ -301,7 +303,7 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArg
     *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(nodePositionWithLoopback(src->id()));
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
     route->link_list.push_back(info.first);
   }
 
@@ -351,7 +353,7 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArg
   }
 
   if (has_limiter_) { // limiter for receiver
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(dst->id()));
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(dst->id()));
     route->link_list.push_back(info.first);
   }