-/* Copyright (c) 2014-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2014-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. */
#include <simgrid/kernel/routing/FatTreeZone.hpp>
#include <simgrid/kernel/routing/NetPoint.hpp>
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
#include "src/surf/xml/platf.hpp" // surf_parse_error() and surf_parse_assert()
#include <fstream>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_fat_tree, surf, "Routing for fat trees");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_fat_tree, ker_routing, "Kernel Fat-Tree Routing");
namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace kernel::routing {
bool FatTreeZone::is_in_sub_tree(const FatTreeNode* root, const FatTreeNode* node) const
{
for (unsigned int i = 0; i < currentNode->level; i++)
d /= this->num_parents_per_node_[i];
- int k = this->num_parents_per_node_[currentNode->level];
- d = d % k;
+ int k = this->num_parents_per_node_[currentNode->level] * this->num_port_lower_level_[currentNode->level];
+ d = d % k;
if (currentNode->limiter_link_)
into->link_list_.push_back(currentNode->limiter_link_);
// Down part
while (currentNode != destination) {
- for (unsigned int i = 0; i < currentNode->children.size(); i++) {
+ //pick cable when multiple parallels
+ int d = source->position % this->num_port_lower_level_[currentNode->level - 1];
+ for (unsigned int i = d * this->num_children_per_node_[currentNode->level - 1]; i < currentNode->children.size(); i++) {
if (i % this->num_children_per_node_[currentNode->level - 1] == destination->label[currentNode->level - 1]) {
add_link_latency(into->link_list_, currentNode->children[i]->down_link_, latency);
if (this->levels_ == 0) {
return;
}
- if (not XBT_LOG_ISENABLED(surf_route_fat_tree, xbt_log_priority_debug)) {
+ if (not XBT_LOG_ISENABLED(ker_routing_fat_tree, xbt_log_priority_debug)) {
return;
}
{
std::stringstream msgBuffer;
- if (XBT_LOG_ISENABLED(surf_route_fat_tree, xbt_log_priority_debug)) {
+ if (XBT_LOG_ISENABLED(ker_routing_fat_tree, xbt_log_priority_debug)) {
msgBuffer << "Are " << child->id << "(" << child->level << "," << child->position << ") <";
for (unsigned int i = 0; i < this->levels_; i++) {
}
/* get limiter for this router */
- auto get_limiter = [this, &set_callbacks](unsigned long i, unsigned long j, long id) -> resource::LinkImpl* {
- kernel::resource::LinkImpl* limiter = nullptr;
+ auto get_limiter = [this, &set_callbacks](unsigned long i, unsigned long j, long id) -> resource::StandardLinkImpl* {
+ kernel::resource::StandardLinkImpl* limiter = nullptr;
if (set_callbacks.limiter) {
const auto* s4u_link = set_callbacks.limiter(get_iface(), {i + 1, j}, id);
if (s4u_link) {
}
for (unsigned int j = 0; j < this->nodes_by_level_[i]; j++) {
- if (XBT_LOG_ISENABLED(surf_route_fat_tree, xbt_log_priority_debug)) {
+ if (XBT_LOG_ISENABLED(ker_routing_fat_tree, xbt_log_priority_debug)) {
std::stringstream msgBuffer;
msgBuffer << "Assigning label <";
return tempPosition;
}
-void FatTreeZone::add_processing_node(int id, resource::LinkImpl* limiter, resource::LinkImpl* loopback)
+void FatTreeZone::add_processing_node(int id, resource::StandardLinkImpl* limiter, resource::StandardLinkImpl* loopback)
{
using std::make_pair;
static int position = 0;
position++;
newNode->parents.resize(static_cast<size_t>(this->num_parents_per_node_[0]) * this->num_port_lower_level_[0]);
newNode->label.resize(this->levels_);
- this->compute_nodes_.insert(make_pair(id, newNode));
+ this->compute_nodes_.try_emplace(id, newNode);
this->nodes_.emplace_back(newNode);
}
file << "}";
file.close();
}
-} // namespace routing
-} // namespace kernel
+} // namespace kernel::routing
namespace s4u {
FatTreeParams::FatTreeParams(unsigned int n_levels, const std::vector<unsigned int>& down_links,