Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to reduce brain overload
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 7 Nov 2017 08:00:21 +0000 (09:00 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 7 Nov 2017 08:00:21 +0000 (09:00 +0100)
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/DragonflyZone.hpp

index fd60b9d..429a863 100644 (file)
@@ -112,12 +112,13 @@ 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]);
   }
 
+  if (cluster->sharing_policy == SURF_LINK_FULLDUPLEX)
+    this->numLinksperLink_ = 2;
+
   this->cluster_ = cluster;
 }
 
-/*
-* Generate the cluster once every node is created
-*/
+/* Generate the cluster once every node is created */
 void DragonflyZone::seal()
 {
   if (this->numNodesPerBlade_ == 0) {
@@ -167,14 +168,9 @@ void DragonflyZone::createLink(const std::string& id, int numlinks, surf::LinkIm
   sg_platf_new_link(&linkTemplate);
   XBT_DEBUG("Generating link %s", id.c_str());
   surf::LinkImpl* link;
-  std::string tmpID;
   if (this->cluster_->sharing_policy == SURF_LINK_FULLDUPLEX) {
-    tmpID     = linkTemplate.id + "_UP";
-    link      = surf::LinkImpl::byName(tmpID);
-    *linkup   = link; // check link?
-    tmpID     = linkTemplate.id + "_DOWN";
-    link      = surf::LinkImpl::byName(tmpID);
-    *linkdown = link; // check link ?
+    *linkup   = surf::LinkImpl::byName(linkTemplate.id + "_UP");   // check link?
+    *linkdown = surf::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ?
   } else {
     link      = surf::LinkImpl::byName(linkTemplate.id);
     *linkup   = link;
@@ -190,9 +186,6 @@ void DragonflyZone::generateLinks()
 
   unsigned int numRouters = this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_;
 
-  if (this->cluster_->sharing_policy == SURF_LINK_FULLDUPLEX)
-    numLinksperLink_ = 2;
-
   // Links from routers to their local nodes.
   for (unsigned int i = 0; i < numRouters; i++) {
     // allocate structures
@@ -205,12 +198,10 @@ void DragonflyZone::generateLinks()
           std::to_string(j / numLinksperLink_) + "_" + std::to_string(uniqueId);
       this->createLink(id, 1, &linkup, &linkdown);
 
-      if (this->cluster_->sharing_policy == SURF_LINK_FULLDUPLEX) {
-        this->routers_[i]->myNodes_[j]     = linkup;
+      this->routers_[i]->myNodes_[j] = linkup;
+      if (this->cluster_->sharing_policy == SURF_LINK_FULLDUPLEX)
         this->routers_[i]->myNodes_[j + 1] = linkdown;
-      } else {
-        this->routers_[i]->myNodes_[j] = linkup;
-      }
+
       uniqueId++;
     }
   }
index 6feea64..fd63be5 100644 (file)
@@ -72,7 +72,7 @@ public:
 
 private:
   void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
-  ClusterCreationArgs* cluster_;
+  ClusterCreationArgs* cluster_     = nullptr;
   unsigned int numNodesPerBlade_    = 0;
   unsigned int numBladesPerChassis_ = 0;
   unsigned int numChassisPerGroup_  = 0;