A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FatTreeZone: Add limiters for switches
[simgrid.git]
/
src
/
kernel
/
routing
/
ClusterZone.cpp
diff --git
a/src/kernel/routing/ClusterZone.cpp
b/src/kernel/routing/ClusterZone.cpp
index
fc35ba1
..
43651e2
100644
(file)
--- 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 "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");
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<resource::LinkImpl*, resource::LinkImpl*> link)
{
private_links_.insert({position, link});
}
void ClusterZone::add_private_link_at(unsigned int position, std::pair<resource::LinkImpl*, resource::LinkImpl*> link)
{
private_links_.insert({position, link});
}
-void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, Route
CreationArgs
* 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(),
{
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<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
XBT_WARN("Routing from a cluster private router to itself is meaningless");
} else {
std::pair<resource::LinkImpl*, resource::LinkImpl*> 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();
}
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<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
if (not src->is_router()) { // No private link for the private router
if (has_limiter_) { // limiter for sender
std::pair<resource::LinkImpl*, resource::LinkImpl*> 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<resource::LinkImpl*, resource::LinkImpl*> info =
private_links_.at(node_pos_with_loopback_limiter(src->id()));
if (info.first) { // link up
}
std::pair<resource::LinkImpl*, resource::LinkImpl*> 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_) {
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();
}
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
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()));
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::map<std::string, xb
}
}
}
}
-void ClusterZone::create_links
_for_node(const ClusterCreationArgs* cluster, int id, int /*rank*/, unsigned int position
)
+void ClusterZone::create_links
(int id, int rank
)
{
{
- std::string link_id =
cluster->id
+ "_link_" + std::to_string(id);
+ std::string link_id =
get_name()
+ "_link_" + std::to_string(id);
const s4u::Link* linkUp;
const s4u::Link* linkDown;
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<double>{
cluster->bw})->set_latency(cluster->lat
)->seal();
- linkDown = create_link(link_id + "_DOWN", std::vector<double>{
cluster->bw})->set_latency(cluster->lat
)->seal();
+ if (
link_sharing_policy_
== simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX) {
+ linkUp = create_link(link_id + "_UP", std::vector<double>{
link_bw_})->set_latency(link_lat_
)->seal();
+ linkDown = create_link(link_id + "_DOWN", std::vector<double>{
link_bw_})->set_latency(link_lat_
)->seal();
} else {
} else {
- linkUp = create_link(link_id, std::vector<double>{
cluster->bw})->set_latency(cluster->lat
)->seal();
+ linkUp = create_link(link_id, std::vector<double>{
link_bw_})->set_latency(link_lat_
)->seal();
linkDown = linkUp;
}
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)
}
void ClusterZone::set_gateway(unsigned int position, NetPoint* gateway)
@@
-175,9
+181,7
@@
NetPoint* ClusterZone::get_gateway(unsigned int position)
}
void ClusterZone::fill_leaf_from_cb(unsigned int position, const std::vector<unsigned int>& dimensions,
}
void ClusterZone::fill_leaf_from_cb(unsigned int position, const std::vector<unsigned int>& dimensions,
- const std::function<s4u::ClusterNetPointCb>& set_netpoint_cb,
- const std::function<s4u::ClusterLinkCb>& set_loopback_cb,
- const std::function<s4u::ClusterLinkCb>& set_limiter_cb, NetPoint** node_netpoint,
+ const s4u::ClusterCallbacks& set_callbacks, NetPoint** node_netpoint,
s4u::Link** lb_link, s4u::Link** limiter_link)
{
xbt_assert(node_netpoint, "Invalid node_netpoint parameter");
s4u::Link** lb_link, s4u::Link** limiter_link)
{
xbt_assert(node_netpoint, "Invalid node_netpoint parameter");
@@
-203,7
+207,7
@@
void ClusterZone::fill_leaf_from_cb(unsigned int position, const std::vector<uns
kernel::routing::NetPoint* netpoint = nullptr;
kernel::routing::NetPoint* gw = nullptr;
auto dims = index_to_dims(position);
kernel::routing::NetPoint* netpoint = nullptr;
kernel::routing::NetPoint* gw = nullptr;
auto dims = index_to_dims(position);
- std::tie(netpoint, gw) = set_
netpoint_cb
(get_iface(), dims, position);
+ std::tie(netpoint, gw) = set_
callbacks.netpoint
(get_iface(), dims, position);
xbt_assert(netpoint, "set_netpoint(elem=%u): Invalid netpoint (nullptr)", position);
if (netpoint->is_netzone()) {
xbt_assert(gw && not gw->is_netzone(),
xbt_assert(netpoint, "set_netpoint(elem=%u): Invalid netpoint (nullptr)", position);
if (netpoint->is_netzone()) {
xbt_assert(gw && not gw->is_netzone(),
@@
-215,16
+219,16
@@
void ClusterZone::fill_leaf_from_cb(unsigned int position, const std::vector<uns
// setting gateway
set_gateway(position, gw);
// setting gateway
set_gateway(position, gw);
- if (set_
loopback_cb
) {
- s4u::Link* loopback = set_
loopback_cb
(get_iface(), dims, position);
+ if (set_
callbacks.loopback
) {
+ s4u::Link* loopback = set_
callbacks.loopback
(get_iface(), dims, position);
xbt_assert(loopback, "set_loopback: Invalid loopback link (nullptr) for element %u", position);
set_loopback();
add_private_link_at(node_pos(netpoint->id()), {loopback->get_impl(), loopback->get_impl()});
*lb_link = loopback;
}
xbt_assert(loopback, "set_loopback: Invalid loopback link (nullptr) for element %u", position);
set_loopback();
add_private_link_at(node_pos(netpoint->id()), {loopback->get_impl(), loopback->get_impl()});
*lb_link = loopback;
}
- if (set_
limiter_cb
) {
- s4u::Link* limiter = set_
limiter_cb
(get_iface(), dims, position);
+ if (set_
callbacks.limiter
) {
+ s4u::Link* limiter = set_
callbacks.limiter
(get_iface(), dims, position);
xbt_assert(limiter, "set_limiter: Invalid limiter link (nullptr) for element %u", position);
set_limiter();
add_private_link_at(node_pos_with_loopback(netpoint->id()), {limiter->get_impl(), limiter->get_impl()});
xbt_assert(limiter, "set_limiter: Invalid limiter link (nullptr) for element %u", position);
set_limiter();
add_private_link_at(node_pos_with_loopback(netpoint->id()), {limiter->get_impl(), limiter->get_impl()});
@@
-235,12
+239,4
@@
void ClusterZone::fill_leaf_from_cb(unsigned int position, const std::vector<uns
} // namespace routing
} // namespace kernel
} // namespace routing
} // namespace kernel
-
-namespace s4u {
-NetZone* create_cluster_zone(const std::string& name)
-{
- return (new kernel::routing::ClusterZone(name))->get_iface();
-}
-} // namespace s4u
-
} // namespace simgrid
} // namespace simgrid