From: Frederic Suter Date: Tue, 7 Nov 2017 08:00:21 +0000 (+0100) Subject: try to reduce brain overload X-Git-Tag: v3.18~242^2~85 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d6aa3f4818e3590d9d305f5e6bca1bc0a7780ceb?ds=sidebyside try to reduce brain overload --- diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index fd60b9daf4..429a863b43 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -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++; } } diff --git a/src/kernel/routing/DragonflyZone.hpp b/src/kernel/routing/DragonflyZone.hpp index 6feea64578..fd63be55e4 100644 --- a/src/kernel/routing/DragonflyZone.hpp +++ b/src/kernel/routing/DragonflyZone.hpp @@ -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;