Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add Dragonfly topology. Use XC30's Cray description as a basis
[simgrid.git] / src / surf / sg_platf.cpp
index 0f8a2a7..f67e1a6 100644 (file)
@@ -27,6 +27,7 @@
 #include "src/surf/AsCluster.hpp"
 #include "src/surf/AsClusterTorus.hpp"
 #include "src/surf/AsClusterFatTree.hpp"
+#include "src/surf/AsClusterDragonfly.hpp"
 #include "src/surf/AsDijkstra.hpp"
 #include "src/surf/AsFloyd.hpp"
 #include "src/surf/AsFull.hpp"
@@ -111,7 +112,7 @@ void sg_platf_exit(void) {
 /** @brief Add an "host" to the current AS */
 void sg_platf_new_host(sg_platf_host_cbarg_t host)
 {
-  xbt_assert(! sg_host_by_name(host->id), "Refusing to create a second host named '%s'.", host->id);
+  xbt_assert(sg_host_by_name(host->id) == nullptr, "Refusing to create a second host named '%s'.", host->id);
 
   simgrid::surf::AsImpl* current_routing = routing_get_current();
   if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
@@ -123,7 +124,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
   sg_host_t h = simgrid::s4u::Host::by_name_or_create(host->id);
   h->pimpl_netcard = netcard;
 
-  if(mount_list){
+  if(mount_list) {
     xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);
     mount_list = nullptr;
   }
@@ -184,7 +185,7 @@ void sg_platf_new_router(sg_platf_router_cbarg_t router)
   simgrid::surf::NetCard* netcard =
     new simgrid::surf::NetCardImpl(router->id, simgrid::surf::NetCard::Type::Router, current_routing);
   xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, netcard);
-  XBT_DEBUG("Having set name '%s' id '%d'", router->id, netcard->id());
+  XBT_DEBUG("Router '%s' has the id %d", router->id, netcard->id());
 
   if (router->coord && strcmp(router->coord, "")) {
     unsigned int cursor;
@@ -237,6 +238,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
 {
   using simgrid::surf::AsCluster;
   using simgrid::surf::AsClusterTorus;
+  using simgrid::surf::AsClusterDragonfly;
   using simgrid::surf::AsClusterFatTree;
 
   int rankId=0;
@@ -250,6 +252,9 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
   case SURF_CLUSTER_TORUS:
     AS.routing = A_surfxml_AS_routing_ClusterTorus;
     break;
+  case SURF_CLUSTER_DRAGONFLY:
+    AS.routing = A_surfxml_AS_routing_ClusterDragonfly;
+    break;
   case SURF_CLUSTER_FAT_TREE:
     AS.routing = A_surfxml_AS_routing_ClusterFatTree;
     break;
@@ -304,8 +309,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
 
     s_surf_parsing_link_up_down_t info_lim, info_loop;
     // All links are saved in a matrix;
-    // every row describes a single node; every node
-    // may have multiple links.
+    // every row describes a single node; every node may have multiple links.
     // the first column may store a link from x to x if p_has_loopback is set
     // the second column may store a limiter link if p_has_limiter is set
     // other columns are to store one or more link for the node
@@ -822,6 +826,7 @@ simgrid::s4u::As * sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
   switch(AS->routing){
     case A_surfxml_AS_routing_Cluster:        new_as = new simgrid::surf::AsCluster(AS->id);        break;
     case A_surfxml_AS_routing_ClusterTorus:   new_as = new simgrid::surf::AsClusterTorus(AS->id);   break;
+    case A_surfxml_AS_routing_ClusterDragonfly:   new_as = new simgrid::surf::AsClusterDragonfly(AS->id);   break;
     case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::surf::AsClusterFatTree(AS->id); break;
     case A_surfxml_AS_routing_Dijkstra:       new_as = new simgrid::surf::AsDijkstra(AS->id, 0);    break;
     case A_surfxml_AS_routing_DijkstraCache:  new_as = new simgrid::surf::AsDijkstra(AS->id, 1);    break;