X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1f5cc4e090af49a98da0e25e9ee21a8ce6ce30f8..3667666354096f7b49be2bac1f9f7e789197b91b:/src/surf/sg_platf.cpp diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index d716fb8723..251c3ce2df 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2006-2022. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -23,8 +23,8 @@ #include "src/kernel/resource/DiskImpl.hpp" #include "src/kernel/resource/profile/Profile.hpp" #include "src/surf/HostImpl.hpp" +#include "src/surf/xml/platf.hpp" #include "src/surf/xml/platf_private.hpp" -#include "surf/surf.hpp" #include #include @@ -56,7 +56,6 @@ void sg_platf_init() void sg_platf_exit() { simgrid::kernel::routing::on_cluster_creation.disconnect_slots(); - simgrid::s4u::Engine::on_platform_created.disconnect_slots(); surf_parse_lex_destroy(); } @@ -114,16 +113,6 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name, return netpoint; } -static void sg_platf_set_link_properties(simgrid::s4u::Link* link, - const simgrid::kernel::routing::LinkCreationArgs* args) -{ - link->set_properties(args->properties) - ->set_state_profile(args->state_trace) - ->set_latency_profile(args->latency_trace) - ->set_bandwidth_profile(args->bandwidth_trace) - ->set_latency(args->latency); -} - void sg_platf_new_link(const simgrid::kernel::routing::LinkCreationArgs* args) { simgrid::s4u::Link* link; @@ -133,7 +122,13 @@ void sg_platf_new_link(const simgrid::kernel::routing::LinkCreationArgs* args) link = current_routing->create_link(args->id, args->bandwidths); link->get_impl()->set_sharing_policy(args->policy, {}); } - sg_platf_set_link_properties(link, args); + + link->set_properties(args->properties) + ->set_state_profile(args->state_trace) + ->set_latency_profile(args->latency_trace) + ->set_bandwidth_profile(args->bandwidth_trace) + ->set_latency(args->latency); + link->seal(); } @@ -223,27 +218,25 @@ static void sg_platf_new_cluster_hierarchical(const simgrid::kernel::routing::Cl } simgrid::s4u::NetZone const* parent = current_routing ? current_routing->get_iface() : nullptr; - simgrid::s4u::NetZone* zone; switch (cluster->topology) { case simgrid::kernel::routing::ClusterTopology::TORUS: - zone = simgrid::s4u::create_torus_zone( - cluster->id, parent, TorusZone::parse_topo_parameters(cluster->topo_parameters), - {set_host, set_loopback, set_limiter}, cluster->bw, cluster->lat, cluster->sharing_policy); + simgrid::s4u::create_torus_zone(cluster->id, parent, TorusZone::parse_topo_parameters(cluster->topo_parameters), + {set_host, set_loopback, set_limiter}, cluster->bw, cluster->lat, + cluster->sharing_policy); break; case simgrid::kernel::routing::ClusterTopology::DRAGONFLY: - zone = simgrid::s4u::create_dragonfly_zone( + simgrid::s4u::create_dragonfly_zone( cluster->id, parent, DragonflyZone::parse_topo_parameters(cluster->topo_parameters), {set_host, set_loopback, set_limiter}, cluster->bw, cluster->lat, cluster->sharing_policy); break; case simgrid::kernel::routing::ClusterTopology::FAT_TREE: - zone = simgrid::s4u::create_fatTree_zone( + simgrid::s4u::create_fatTree_zone( cluster->id, parent, FatTreeZone::parse_topo_parameters(cluster->topo_parameters), {set_host, set_loopback, set_limiter}, cluster->bw, cluster->lat, cluster->sharing_policy); break; default: THROW_IMPOSSIBLE; } - zone->seal(); } /*************************************************************************************************/ @@ -336,7 +329,6 @@ static void sg_platf_new_cluster_flat(simgrid::kernel::routing::ClusterCreationA auto* router = zone->create_router(cluster->router_id); zone->add_route(router, nullptr, nullptr, nullptr, {}); - zone->seal(); simgrid::kernel::routing::on_cluster_creation(*cluster); } @@ -602,7 +594,6 @@ void sg_platf_new_zone_seal() zone_cluster.cabinets.clear(); zone_cluster.backbone.reset(); } - current_routing->seal(); current_routing = current_routing->get_parent(); }