X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/38ffc837c5692a4d52e7610a67453a5335434bbd..4a45895d75b6268e77e7a4d925fd175649e3866a:/src/kernel/routing/ClusterZone.cpp diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index 5d31b78f65..43651e2aa2 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -7,7 +7,6 @@ #include "simgrid/kernel/routing/NetPoint.hpp" #include "simgrid/kernel/routing/RoutedZone.hpp" #include "src/surf/network_interface.hpp" -#include "src/surf/xml/platf_private.hpp" // FIXME: RouteCreationArgs and friends XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"); @@ -35,12 +34,19 @@ void ClusterZone::set_limiter() } } +void ClusterZone::set_link_characteristics(double bw, double lat, s4u::Link::SharingPolicy sharing_policy) +{ + link_sharing_policy_ = sharing_policy; + link_bw_ = bw; + link_lat_ = lat; +} + void ClusterZone::add_private_link_at(unsigned int position, std::pair link) { private_links_.insert({position, link}); } -void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) +void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat) { XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id()); xbt_assert(not private_links_.empty(), @@ -51,7 +57,7 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg XBT_WARN("Routing from a cluster private router to itself is meaningless"); } else { std::pair info = private_links_.at(node_pos(src->id())); - route->link_list.push_back(info.first); + route->link_list_.push_back(info.first); if (lat) *lat += info.first->get_latency(); } @@ -61,20 +67,20 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg if (not src->is_router()) { // No private link for the private router if (has_limiter_) { // limiter for sender std::pair info = private_links_.at(node_pos_with_loopback(src->id())); - route->link_list.push_back(info.first); + route->link_list_.push_back(info.first); } std::pair info = private_links_.at(node_pos_with_loopback_limiter(src->id())); if (info.first) { // link up - route->link_list.push_back(info.first); + route->link_list_.push_back(info.first); if (lat) *lat += info.first->get_latency(); } } if (backbone_) { - route->link_list.push_back(backbone_); + route->link_list_.push_back(backbone_); if (lat) *lat += backbone_->get_latency(); } @@ -84,13 +90,13 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg private_links_.at(node_pos_with_loopback_limiter(dst->id())); if (info.second) { // link down - route->link_list.push_back(info.second); + route->link_list_.push_back(info.second); if (lat) *lat += info.second->get_latency(); } if (has_limiter_) { // limiter for receiver info = private_links_.at(node_pos_with_loopback(dst->id())); - route->link_list.push_back(info.first); + route->link_list_.push_back(info.first); } } } @@ -141,20 +147,20 @@ void ClusterZone::get_graph(const s_xbt_graph_t* graph, std::mapid + "_link_" + std::to_string(id); + std::string link_id = get_name() + "_link_" + std::to_string(id); const s4u::Link* linkUp; const s4u::Link* linkDown; - if (cluster->sharing_policy == simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX) { - linkUp = create_link(link_id + "_UP", std::vector{cluster->bw})->set_latency(cluster->lat)->seal(); - linkDown = create_link(link_id + "_DOWN", std::vector{cluster->bw})->set_latency(cluster->lat)->seal(); + if (link_sharing_policy_ == simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX) { + linkUp = create_link(link_id + "_UP", std::vector{link_bw_})->set_latency(link_lat_)->seal(); + linkDown = create_link(link_id + "_DOWN", std::vector{link_bw_})->set_latency(link_lat_)->seal(); } else { - linkUp = create_link(link_id, std::vector{cluster->bw})->set_latency(cluster->lat)->seal(); + linkUp = create_link(link_id, std::vector{link_bw_})->set_latency(link_lat_)->seal(); linkDown = linkUp; } - private_links_.insert({position, {linkUp->get_impl(), linkDown->get_impl()}}); + private_links_.insert({node_pos_with_loopback_limiter(rank), {linkUp->get_impl(), linkDown->get_impl()}}); } void ClusterZone::set_gateway(unsigned int position, NetPoint* gateway)