Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
various small cosmetics in the routing
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 16 Nov 2016 01:28:45 +0000 (02:28 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 16 Nov 2016 01:39:21 +0000 (02:39 +0100)
12 files changed:
src/kernel/routing/AsCluster.cpp
src/kernel/routing/AsCluster.hpp
src/kernel/routing/AsClusterDragonfly.cpp
src/kernel/routing/AsClusterFatTree.cpp
src/kernel/routing/AsClusterTorus.cpp
src/kernel/routing/AsImpl.cpp
src/kernel/routing/AsImpl.hpp
src/kernel/routing/AsNone.cpp
src/kernel/routing/AsRoutedGraph.cpp
src/kernel/routing/AsRoutedGraph.hpp
src/kernel/routing/AsVivaldi.cpp
src/kernel/routing/AsVivaldi.hpp

index 57281c1..9782f36 100644 (file)
@@ -17,14 +17,15 @@ namespace routing {
 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_ ){
@@ -35,10 +36,9 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb
       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));
index 4526849..f631d29 100644 (file)
@@ -17,7 +17,6 @@ namespace routing {
 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;
index 03e386e..70fa371 100644 (file)
@@ -271,8 +271,7 @@ void AsClusterDragonfly::getRouteAndLatency(NetCard * src, NetCard * dst, sg_pla
   }
 
   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);
   }
 
@@ -328,8 +327,7 @@ void AsClusterDragonfly::getRouteAndLatency(NetCard * src, NetCard * dst, sg_pla
   }
 
   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);
   }
 
@@ -341,7 +339,5 @@ void AsClusterDragonfly::getRouteAndLatency(NetCard * src, NetCard * dst, sg_pla
 
   xbt_free(myCoords);
   xbt_free(targetCoords);
-
-  
 }
 }}} // namespace
index be82801..6ec9a50 100644 (file)
@@ -61,43 +61,33 @@ void AsClusterFatTree::getRouteAndLatency(NetCard *src,
                                           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)) {
@@ -126,7 +116,7 @@ void AsClusterFatTree::getRouteAndLatency(NetCard *src,
             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]) {
index a65bbad..5b5f76e 100644 (file)
@@ -117,7 +117,7 @@ namespace simgrid {
       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);
@@ -140,9 +140,8 @@ namespace simgrid {
        * 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
index a0841b9..0a84c25 100644 (file)
@@ -25,7 +25,6 @@ namespace simgrid {
     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)
   {
index 625aaa0..1943e61 100644 (file)
@@ -30,7 +30,6 @@ namespace routing {
 
   protected:
     explicit AsImpl(As * father, const char* name);
-    ~AsImpl() override;
 
   public:
     /** @brief Make an host within that AS */
index 66c5097..cb56c36 100644 (file)
@@ -18,8 +18,7 @@ namespace routing {
 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*/)
index 20b0910..c98c6b0 100644 (file)
@@ -30,8 +30,6 @@ AsRoutedGraph::AsRoutedGraph(As* father, const char* name) : AsImpl(father, name
 {
 }
 
-AsRoutedGraph::~AsRoutedGraph()=default;
-
 }}} // namespace simgrid::kernel::routing
 
 /* ************************************************************************** */
index b4f5d1f..ad5daa7 100644 (file)
@@ -15,7 +15,6 @@ namespace routing {
 class XBT_PRIVATE AsRoutedGraph : public AsImpl {
 public:
   explicit AsRoutedGraph(As* father, const char* name);
-  ~AsRoutedGraph() override;
 
   void getOneLinkRoutes(std::vector<Onelink*>* accumulator) override;
 
index 3dd3562..a3764cf 100644 (file)
@@ -82,14 +82,12 @@ static inline double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t
   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);
index 42f3372..8477b6e 100644 (file)
@@ -16,7 +16,6 @@ namespace routing {
 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;
 };