AsCluster::AsCluster(As* father, const char* name) : AsImpl(father, name)
{
}
-AsCluster::~AsCluster() = default;
void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat)
{
s_surf_parsing_link_up_down_t info;
XBT_VERB("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]", src->name().c_str(), src->id(),
dst->name().c_str(), dst->id());
- xbt_assert(!privateLinks_.empty(), "Cluster routing : no links attached to the source node - did you use host_link tag?");
+ xbt_assert(!privateLinks_.empty(),
+ "Cluster routing: no links attached to the source node - did you use host_link tag?");
+
if (! src->isRouter()) { // No specific link for router
if((src->id() == dst->id()) && hasLoopback_ ){
return;
}
-
if (hasLimiter_){ // limiter for sender
info = privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_?1:0));
- route->link_list->push_back((Link*)info.linkUp);
+ route->link_list->push_back(info.linkUp);
}
info = privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_?1:0) + (hasLimiter_?1:0));
class XBT_PRIVATE AsCluster: public AsImpl {
public:
explicit AsCluster(As* father, const char* name);
- ~AsCluster() override;
void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override;
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
}
if (hasLimiter_) { // limiter for sender
- s_surf_parsing_link_up_down_t info;
- info = privateLinks_.at(src->id() * linkCountPerNode_ + hasLoopback_);
+ s_surf_parsing_link_up_down_t info = privateLinks_.at(src->id() * linkCountPerNode_ + hasLoopback_);
route->link_list->push_back(info.linkUp);
}
}
if (hasLimiter_) { // limiter for receiver
- s_surf_parsing_link_up_down_t info;
- info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_);
+ s_surf_parsing_link_up_down_t info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_);
route->link_list->push_back(info.linkUp);
}
xbt_free(myCoords);
xbt_free(targetCoords);
-
-
}
}}} // namespace
NetCard *dst,
sg_platf_route_cbarg_t into,
double *latency) {
- FatTreeNode *source, *destination, *currentNode;
-
- std::map<int, FatTreeNode*>::const_iterator tempIter;
if (dst->isRouter() || src->isRouter())
return;
/* Let's find the source and the destination in our internal structure */
- tempIter = this->computeNodes_.find(src->id());
+ std::map<int, FatTreeNode*>::const_iterator tempIter = this->computeNodes_.find(src->id());
+ xbt_assert(tempIter != this->computeNodes_.end(), "Could not find the source %s [%d] in the fat tree",
+ src->name().c_str(), src->id());
+ FatTreeNode* source = tempIter->second;
- // xbt_die -> assert
- if (tempIter == this->computeNodes_.end()) {
- xbt_die("Could not find the source %s [%d] in the fat tree", src->name().c_str(), src->id());
- }
- source = tempIter->second;
tempIter = this->computeNodes_.find(dst->id());
- if (tempIter == this->computeNodes_.end()) {
- xbt_die("Could not find the destination %s [%d] in the fat tree", dst->name().c_str(), dst->id());
- }
-
-
- destination = tempIter->second;
+ xbt_assert(tempIter != this->computeNodes_.end(), "Could not find the destination %s [%d] in the fat tree",
+ dst->name().c_str(), dst->id());
+ FatTreeNode* destination = tempIter->second;
XBT_VERB("Get route and latency from '%s' [%d] to '%s' [%d] in a fat tree", src->name().c_str(), src->id(),
dst->name().c_str(), dst->id());
- /* In case destination is the source, and there is a loopback, let's get
- through it instead of going up to a switch*/
- if(source->id == destination->id && this->hasLoopback_) {
+ /* 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->hasLoopback_) {
into->link_list->push_back(source->loopback);
- if(latency) {
+ if (latency)
*latency += source->loopback->latency();
- }
return;
}
- currentNode = source;
+ FatTreeNode* currentNode = source;
// up part
while (!isInSubTree(currentNode, destination)) {
currentNode->level, currentNode->position);
// Down part
- while(currentNode != destination) {
+ while (currentNode != destination) {
for(unsigned int i = 0 ; i < currentNode->children.size() ; i++) {
if(i % this->lowerLevelNodesNumber_[currentNode->level - 1] ==
destination->label[currentNode->level - 1]) {
if (dst->isRouter() || src->isRouter())
return;
- if ((src->id() == dst->id()) && hasLoopback_) {
+ if (src->id() == dst->id() && hasLoopback_) {
s_surf_parsing_link_up_down_t info = privateLinks_.at(src->id() * linkCountPerNode_);
route->link_list->push_back(info.linkUp);
* both arrays, we can easily assess whether we need to route
* into this dimension or not.
*/
- unsigned int *myCoords, *targetCoords;
- myCoords = rankId_to_coords(src->id(), dimensions_);
- targetCoords = rankId_to_coords(dst->id(), dimensions_);
+ unsigned int* myCoords = rankId_to_coords(src->id(), dimensions_);
+ unsigned int* targetCoords = rankId_to_coords(dst->id(), dimensions_);
/*
* linkOffset describes the offset where the link
* we want to use is stored
xbt_lib_set(as_router_lib, name, ROUTING_ASR_LEVEL, static_cast<void*>(netcard_));
XBT_DEBUG("AS '%s' created with the id '%d'", name, netcard_->id());
}
- AsImpl::~AsImpl() = default;
simgrid::s4u::Host* AsImpl::createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount)
{
protected:
explicit AsImpl(As * father, const char* name);
- ~AsImpl() override;
public:
/** @brief Make an host within that AS */
AsNone::AsNone(As* father, const char* name) : AsImpl(father, name)
{}
-AsNone::~AsNone()
-{}
+AsNone::~AsNone() = default;
void AsNone::getRouteAndLatency(NetCard * /*src*/, NetCard * /*dst*/,
sg_platf_route_cbarg_t /*res*/, double */*lat*/)
{
}
-AsRoutedGraph::~AsRoutedGraph()=default;
-
}}} // namespace simgrid::kernel::routing
/* ************************************************************************** */
class XBT_PRIVATE AsRoutedGraph : public AsImpl {
public:
explicit AsRoutedGraph(As* father, const char* name);
- ~AsRoutedGraph() override;
void getOneLinkRoutes(std::vector<Onelink*>* accumulator) override;
AsVivaldi::AsVivaldi(As* father, const char* name) : AsCluster(father, name)
{}
-AsVivaldi::~AsVivaldi() {}
-
void AsVivaldi::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat)
{
XBT_DEBUG("vivaldi_get_route_and_latency from '%s'[%d] '%s'[%d]", src->name().c_str(), src->id(), dst->name().c_str(),
dst->id());
- if(src->isAS()) {
+ if (src->isAS()) {
char* srcName = bprintf("router_%s", src->name().c_str());
char* dstName = bprintf("router_%s", dst->name().c_str());
route->gw_src = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib, srcName, ROUTING_ASR_LEVEL);
class XBT_PRIVATE AsVivaldi: public AsCluster {
public:
explicit AsVivaldi(As* father, const char* name);
- ~AsVivaldi() override;
void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override;
};