/* 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. */
/* 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. */
-FatTreeZone::FatTreeZone(NetZone* father, std::string name) : ClusterZone(father, name)
+FatTreeZone::FatTreeZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
+ : ClusterZone(father, name, netmodel)
{
XBT_DEBUG("Is %d(%u,%u) in the sub tree of %d(%u,%u) ?", node->id, node->level, node->position, root->id, root->level,
root->position);
{
XBT_DEBUG("Is %d(%u,%u) in the sub tree of %d(%u,%u) ?", node->id, node->level, node->position, root->id, root->level,
root->position);
-void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency)
+void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency)
return;
/* Let's find the source and the destination in our internal structure */
auto searchedNode = this->compute_nodes_.find(src->id());
xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the source %s [%u] in the fat tree",
return;
/* Let's find the source and the destination in our internal structure */
auto searchedNode = this->compute_nodes_.find(src->id());
xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the source %s [%u] in the fat tree",
FatTreeNode* source = searchedNode->second;
searchedNode = this->compute_nodes_.find(dst->id());
xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the destination %s [%u] in the fat tree",
FatTreeNode* source = searchedNode->second;
searchedNode = this->compute_nodes_.find(dst->id());
xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the destination %s [%u] in the fat tree",
- XBT_VERB("Get route and latency from '%s' [%u] to '%s' [%u] in a fat tree", src->getCname(), src->id(),
- dst->getCname(), dst->id());
+ XBT_VERB("Get route and latency from '%s' [%u] to '%s' [%u] in a fat tree", src->get_cname(), src->id(),
+ dst->get_cname(), dst->id());
/* In case destination is the source, and there is a loopback, let's use it instead of going up to a switch */
if (source->id == destination->id && this->has_loopback_) {
into->link_list.push_back(source->loopback);
if (latency)
/* In case destination is the source, and there is a loopback, let's use it instead of going up to a switch */
if (source->id == destination->id && this->has_loopback_) {
into->link_list.push_back(source->loopback);
if (latency)
int d = destination->position; // as in d-mod-k
for (unsigned int i = 0; i < currentNode->level; i++)
int d = destination->position; // as in d-mod-k
for (unsigned int i = 0; i < currentNode->level; i++)
if (i % this->num_children_per_node_[currentNode->level - 1] == destination->label[currentNode->level - 1]) {
into->link_list.push_back(currentNode->children[i]->down_link_);
if (latency)
if (i % this->num_children_per_node_[currentNode->level - 1] == destination->label[currentNode->level - 1]) {
into->link_list.push_back(currentNode->children[i]->down_link_);
if (latency)
currentNode = currentNode->children[i]->down_node_;
if (this->has_limiter_)
into->link_list.push_back(currentNode->limiter_link_);
currentNode = currentNode->children[i]->down_node_;
if (this->has_limiter_)
into->link_list.push_back(currentNode->limiter_link_);
if (XBT_LOG_ISENABLED(surf_route_fat_tree, xbt_log_priority_debug)) {
std::stringstream msgBuffer;
if (XBT_LOG_ISENABLED(surf_route_fat_tree, xbt_log_priority_debug)) {
std::stringstream msgBuffer;
unsigned int k = 0;
// Nodes are totally ordered, by level and then by position, in this->nodes
for (unsigned int i = 0; i < this->levels_; i++) {
for (unsigned int j = 0; j < this->nodes_by_level_[i]; j++) {
unsigned int k = 0;
// Nodes are totally ordered, by level and then by position, in this->nodes
for (unsigned int i = 0; i < this->levels_; i++) {
for (unsigned int j = 0; j < this->nodes_by_level_[i]; j++) {
{
std::vector<FatTreeNode*>::iterator currentParentNode = this->nodes_.begin();
int connectionsNumber = 0;
const int level = node->level;
XBT_DEBUG("We are connecting node %d(%u,%u) to his parents.", node->id, node->level, node->position);
{
std::vector<FatTreeNode*>::iterator currentParentNode = this->nodes_.begin();
int connectionsNumber = 0;
const int level = node->level;
XBT_DEBUG("We are connecting node %d(%u,%u) to his parents.", node->id, node->level, node->position);
XBT_DEBUG("%d(%u,%u) and %d(%u,%u) are related,"
" with %u links between them.",
node->id, node->level, node->position, (*currentParentNode)->id, (*currentParentNode)->level,
(*currentParentNode)->position, this->num_port_lower_level_[level]);
for (unsigned int j = 0; j < this->num_port_lower_level_[level]; j++) {
XBT_DEBUG("%d(%u,%u) and %d(%u,%u) are related,"
" with %u links between them.",
node->id, node->level, node->position, (*currentParentNode)->id, (*currentParentNode)->level,
(*currentParentNode)->position, this->num_port_lower_level_[level]);
for (unsigned int j = 0; j < this->num_port_lower_level_[level]; j++) {
- this->addLink(*currentParentNode, node->label[level] + j * this->num_children_per_node_[level], node,
- (*currentParentNode)->label[level] + j * this->num_parents_per_node_[level]);
+ this->add_link(*currentParentNode, node->label[level] + j * this->num_children_per_node_[level], node,
+ (*currentParentNode)->label[level] + j * this->num_parents_per_node_[level]);
{
XBT_DEBUG("Generating switches.");
this->nodes_by_level_.resize(this->levels_ + 1, 0);
{
XBT_DEBUG("Generating switches.");
this->nodes_by_level_.resize(this->levels_ + 1, 0);
surf_parse_error(std::string("The number of provided nodes does not fit with the wanted topology.") +
" Please check your platform description (We need " + std::to_string(this->nodes_by_level_[0]) +
"nodes, we got " + std::to_string(this->nodes_.size()));
surf_parse_error(std::string("The number of provided nodes does not fit with the wanted topology.") +
" Please check your platform description (We need " + std::to_string(this->nodes_by_level_[0]) +
"nodes, we got " + std::to_string(this->nodes_.size()));
-void FatTreeZone::addLink(FatTreeNode* parent, unsigned int parentPort, FatTreeNode* child, unsigned int childPort)
+void FatTreeZone::add_link(FatTreeNode* parent, unsigned int parentPort, FatTreeNode* child, unsigned int childPort)
if (cluster->limiter_link) {
linkTemplate.bandwidth = cluster->limiter_link;
linkTemplate.latency = 0;
if (cluster->limiter_link) {
linkTemplate.bandwidth = cluster->limiter_link;
linkTemplate.latency = 0;
}
if (cluster->loopback_bw || cluster->loopback_lat) {
linkTemplate.bandwidth = cluster->loopback_bw;
linkTemplate.latency = cluster->loopback_lat;
}
if (cluster->loopback_bw || cluster->loopback_lat) {
linkTemplate.bandwidth = cluster->loopback_bw;
linkTemplate.latency = cluster->loopback_lat;
"link_from_" + std::to_string(downNode->id) + "_" + std::to_string(upNode->id) + "_" + std::to_string(uniqueId);
sg_platf_new_link(&linkTemplate);
"link_from_" + std::to_string(downNode->id) + "_" + std::to_string(upNode->id) + "_" + std::to_string(uniqueId);
sg_platf_new_link(&linkTemplate);
- if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX) {
- std::string tmpID = std::string(linkTemplate.id) + "_UP";
- this->up_link_ = surf::LinkImpl::byName(tmpID); // check link?
- tmpID = std::string(linkTemplate.id) + "_DOWN";
- this->down_link_ = surf::LinkImpl::byName(tmpID); // check link ?
+ if (cluster->sharing_policy == s4u::Link::SharingPolicy::SPLITDUPLEX) {
+ this->up_link_ = s4u::Link::by_name(linkTemplate.id + "_UP")->get_impl(); // check link?
+ this->down_link_ = s4u::Link::by_name(linkTemplate.id + "_DOWN")->get_impl(); // check link ?