From 9d616546a15fec501df78b9fcf8eff7b447fde30 Mon Sep 17 00:00:00 2001 From: SUTER Frederic Date: Tue, 6 Apr 2021 18:53:42 +0200 Subject: [PATCH] prefer create_host than creating the creation args --- src/surf/sg_platf.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index e9e00395dd..4fd51a357c 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -173,26 +173,20 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster for (int const& i : *cluster->radicals) { std::string host_id = std::string(cluster->prefix) + std::to_string(i) + cluster->suffix; - std::string link_id = std::string(cluster->id) + "_link_" + std::to_string(i); - - XBT_DEBUG("", host_id.c_str(), cluster->speeds.front()); - simgrid::kernel::routing::HostCreationArgs host; - host.id = host_id; - if ((cluster->properties != nullptr) && (not cluster->properties->empty())) { - host.properties = new std::unordered_map(); + XBT_DEBUG("", host_id.c_str(), cluster->speeds.front()); + simgrid::s4u::Host* host = + current_zone->create_host(host_id, cluster->speeds)->set_core_count(cluster->core_amount); + ; - for (auto const& elm : *cluster->properties) - host.properties->insert({elm.first, elm.second}); - } + if ((cluster->properties != nullptr) && (not cluster->properties->empty())) + host->set_properties(*cluster->properties); + host->seal(); + simgrid::s4u::Host::on_creation(*host); // notify the signal - host.speed_per_pstate = cluster->speeds; - host.pstate = 0; - host.core_amount = cluster->core_amount; - host.coord = ""; - sg_platf_new_host(&host); XBT_DEBUG(""); + std::string link_id = std::string(cluster->id) + "_link_" + std::to_string(i); XBT_DEBUG("", link_id.c_str(), cluster->bw, cluster->lat); // All links are saved in a matrix; -- 2.20.1