From 192d9e1ebfddb174fe5e12d6ade5e9c4d543c959 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 3 Apr 2018 10:18:58 +0200 Subject: [PATCH] DragonflyZone: do not save the whole ClusterCreationArgs structure --- include/simgrid/kernel/routing/DragonflyZone.hpp | 5 ++++- src/kernel/routing/DragonflyZone.cpp | 15 ++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/simgrid/kernel/routing/DragonflyZone.hpp b/include/simgrid/kernel/routing/DragonflyZone.hpp index 4bccc4ecab..f11a8e5469 100644 --- a/include/simgrid/kernel/routing/DragonflyZone.hpp +++ b/include/simgrid/kernel/routing/DragonflyZone.hpp @@ -73,7 +73,10 @@ public: void rankId_to_coords(int rankId, unsigned int (*coords)[4]); private: - ClusterCreationArgs* cluster_ = nullptr; + e_surf_link_sharing_policy_t sharing_policy_; + double bw_ = 0; + double lat_ = 0; + unsigned int num_nodes_per_blade_ = 0; unsigned int num_blades_per_chassis_ = 0; unsigned int num_chassis_per_group_ = 0; diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 5d31232eb2..a0ada55487 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -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++; -- 2.20.1