public:
explicit ClusterZone(NetZone* father, std::string name);
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
/* The pair is {linkUp, linkDown} */
std::unordered_map<unsigned int, std::pair<surf::LinkImpl*, surf::LinkImpl*>> private_links_;
- unsigned int nodePosition(int id) { return id * num_links_per_node_; }
- unsigned int nodePositionWithLoopback(int id) { return nodePosition(id) + (has_loopback_ ? 1 : 0); }
- unsigned int nodePositionWithLimiter(int id) { return nodePositionWithLoopback(id) + (has_limiter_ ? 1 : 0); }
+ unsigned int node_pos(int id) { return id * num_links_per_node_; }
+ unsigned int node_pos_with_loopback(int id) { return node_pos(id) + (has_loopback_ ? 1 : 0); }
+ unsigned int node_pos_with_loopback_limiter(int id) { return node_pos_with_loopback(id) + (has_limiter_ ? 1 : 0); }
- surf::LinkImpl* backbone_ = nullptr;
void* loopback_ = nullptr;
+ surf::LinkImpl* backbone_ = nullptr;
NetPoint* router_ = nullptr;
bool has_limiter_ = false;
bool has_loopback_ = false;
* After this function returns, any node in the graph
* will have a loopback attached to it.
*/
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override;
- void addRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override;
+ void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
xbt_graph_t route_graph_ = nullptr; /* xbt_graph */
std::map<int, xbt_node_t> graph_node_map_; /* map */
explicit DragonflyZone(NetZone* father, std::string name);
~DragonflyZone() override;
// void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void parse_specific_arguments(ClusterCreationArgs* cluster) override;
void seal() override;
void generateRouters();
explicit EmptyZone(NetZone* father, std::string name);
~EmptyZone() override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override
{
/* There can't be route in an Empty zone */
}
public:
explicit FatTreeZone(NetZone* father, std::string name);
~FatTreeZone() override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
/** \brief Generate the fat tree
*
ClusterCreationArgs* cluster_ = nullptr;
- void addLink(FatTreeNode* parent, unsigned int parent_port, FatTreeNode* child, unsigned int child_port);
+ void add_link(FatTreeNode* parent, unsigned int parent_port, FatTreeNode* child, unsigned int child_port);
int getLevelPosition(const unsigned int level);
void generateLabels();
void generateSwitches();
explicit FloydZone(NetZone* father, std::string name);
~FloydZone() override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
- void addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
- kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
- bool symmetrical) override;
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+ void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+ kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ bool symmetrical) override;
void seal() override;
private:
void seal() override;
~FullZone() override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
- void addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
- kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
- bool symmetrical) override;
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+ void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+ kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
+ bool symmetrical) override;
private:
RouteCreationArgs** routing_table_ = nullptr;
* @param into Container into which the traversed links and gateway informations should be pushed
* @param latency Accumulator in which the latencies should be added (caller must set it to 0)
*/
- virtual void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) = 0;
+ virtual void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) = 0;
/** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */
/* returns whether we found a bypass path */
bool get_bypass_route(routing::NetPoint* src, routing::NetPoint* dst,
public:
explicit TorusZone(NetZone* father, std::string name);
void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position) override;
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void parse_specific_arguments(ClusterCreationArgs* cluster) override;
private:
explicit VivaldiZone(NetZone* father, std::string name);
void setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
- void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
};
namespace vivaldi {
XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_name()") const std::string& getName() const { return get_name(); }
XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_cname()") const char* getCname() const { return get_cname(); }
+ XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::add_route()") void addRoute(
+ kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+ kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+ {
+ add_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
+ }
+ XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::add_bypass_route()") void addBypassRoute(
+ kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+ kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+ {
+ add_bypass_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
+ }
std::vector<NetZone*>* getChildren(); // Sub netzones
void getHosts(std::vector<s4u::Host*> * whereto); // retrieve my content as a vector of hosts
/* Add content to the netzone, at parsing time. It should be sealed afterward. */
virtual int addComponent(kernel::routing::NetPoint * elm); /* A host, a router or a netzone, whatever */
- virtual void addRoute(kernel::routing::NetPoint * src, kernel::routing::NetPoint * dst,
- kernel::routing::NetPoint * gw_src, kernel::routing::NetPoint * gw_dst,
- std::vector<simgrid::surf::LinkImpl*> & link_list, bool symmetrical);
+ virtual void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical);
virtual void add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) = 0;
{
}
-void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* 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(),
if ((src->id() == dst->id()) && has_loopback_) {
xbt_assert(not src->is_router(), "Routing from a cluster private router to itself is meaningless");
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePosition(src->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos(src->id()));
route->link_list.push_back(info.first);
if (lat)
*lat += info.first->latency();
if (not src->is_router()) { // No private link for the private router
if (has_limiter_) { // limiter for sender
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(src->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
route->link_list.push_back(info.first);
}
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLimiter(src->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback_limiter(src->id()));
if (info.first) { // link up
route->link_list.push_back(info.first);
if (lat)
if (not dst->is_router()) { // No specific link for router
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLimiter(dst->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback_limiter(dst->id()));
if (info.second) { // link down
route->link_list.push_back(info.second);
if (lat)
*lat += info.second->latency();
}
if (has_limiter_) { // limiter for receiver
- info = private_links_.at(nodePositionWithLoopback(dst->id()));
+ info = private_links_.at(node_pos_with_loopback(dst->id()));
route->link_list.push_back(info.first);
}
}
xbt_graph_new_edge(route_graph_, src, dst, e_route);
}
-void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
getRouteCheckParams(src, dst);
int src_id = src->id();
{
}
-void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+void DijkstraZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
{
const char* srcName = src->get_cname();
const char* dstName = dst->get_cname();
}
}
-void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency)
+void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency)
{
// Minimal routing version.
// TODO : non-minimal random one, and adaptive ?
dst->id());
if ((src->id() == dst->id()) && has_loopback_) {
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePosition(src->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos(src->id()));
route->link_list.push_back(info.first);
if (latency)
*latency += myRouter->my_nodes_[myCoords[3] * num_links_per_link_]->latency();
if (has_limiter_) { // limiter for sender
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(src->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
route->link_list.push_back(info.first);
}
}
if (has_limiter_) { // limiter for receiver
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(dst->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(node_pos_with_loopback(dst->id()));
route->link_list.push_back(info.first);
}
return true;
}
-void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency)
+void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency)
{
if (dst->is_router() || src->is_router())
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]);
}
connectionsNumber++;
}
this->nodes_.push_back(newNode);
}
-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)
{
FatTreeLink* newLink;
newLink = new FatTreeLink(this->cluster_, child, parent);
delete[] cost_table_;
}
-void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
unsigned int table_size = getTableSize();
}
}
-void FloydZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+void FloydZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
{
/* set the size of table routing */
unsigned int table_size = getTableSize();
}
}
-void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* res, double* lat)
+void FullZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* res, double* lat)
{
XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
}
}
-void FullZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
- kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
- std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
+void FullZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+ kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+ std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical)
{
addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
/* If src and dst are in the same netzone, life is good */
if (src_ancestor == dst_ancestor) { /* SURF_ROUTING_BASE */
route.link_list = std::move(links);
- common_ancestor->getLocalRoute(src, dst, &route, latency);
+ common_ancestor->get_local_route(src, dst, &route, latency);
links = std::move(route.link_list);
return;
}
/* Not in the same netzone, no bypass. We'll have to find our path between the netzones recursively */
- common_ancestor->getLocalRoute(src_ancestor->netpoint_, dst_ancestor->netpoint_, &route, latency);
+ common_ancestor->get_local_route(src_ancestor->netpoint_, dst_ancestor->netpoint_, &route, latency);
xbt_assert((route.gw_src != nullptr) && (route.gw_dst != nullptr), "bad gateways for route from \"%s\" to \"%s\"",
src->get_cname(), dst->get_cname());
RouteCreationArgs* route = new RouteCreationArgs();
- getLocalRoute(my_src, my_dst, route, nullptr);
+ get_local_route(my_src, my_dst, route, nullptr);
XBT_DEBUG("get_route_and_latency %s -> %s", my_src->get_cname(), my_dst->get_cname());
}
}
-void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
private_links_.insert({netpoint->id(), {linkUp, linkDown}});
}
-void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void VivaldiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
return vertices_.size() - 1; // The rank of the newly created object
}
-void NetZone::addRoute(sg_netpoint_t /*src*/, sg_netpoint_t /*dst*/, sg_netpoint_t /*gw_src*/, sg_netpoint_t /*gw_dst*/,
- std::vector<simgrid::surf::LinkImpl*>& /*link_list*/, bool /*symmetrical*/)
+void NetZone::add_route(sg_netpoint_t /*src*/, sg_netpoint_t /*dst*/, sg_netpoint_t /*gw_src*/,
+ sg_netpoint_t /*gw_dst*/, std::vector<simgrid::surf::LinkImpl*>& /*link_list*/,
+ bool /*symmetrical*/)
{
xbt_die("NetZone '%s' does not accept new routes (wrong class).", name_.c_str());
}
linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
auto* as_cluster = static_cast<ClusterZone*>(current_as);
- as_cluster->private_links_.insert({as_cluster->nodePosition(rankId), {linkUp, linkDown}});
+ as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp, linkDown}});
}
//add a limiter link (shared link to account for maximal bandwidth of the node)
sg_platf_new_link(&link);
linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
linkUp = linkDown;
- current_as->private_links_.insert({current_as->nodePositionWithLoopback(rankId), {linkUp, linkDown}});
+ current_as->private_links_.insert({current_as->node_pos_with_loopback(rankId), {linkUp, linkDown}});
}
//call the cluster function that adds the others links
if (cluster->topology == simgrid::kernel::routing::ClusterTopology::FAT_TREE) {
static_cast<FatTreeZone*>(current_as)->add_processing_node(i);
} else {
- current_as->create_links_for_node(cluster, i, rankId, current_as->nodePositionWithLimiter(rankId));
+ current_as->create_links_for_node(cluster, i, rankId, current_as->node_pos_with_loopback_limiter(rankId));
}
rankId++;
}
void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
{
- routing_get_current()->addRoute(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
- route->symmetrical);
+ routing_get_current()->add_route(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
+ route->symmetrical);
}
void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreationArgs* bypassRoute)