Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix for manually crafted clusters.
[simgrid.git] / src / surf / sg_platf.cpp
index 7b85965..d85bc7d 100644 (file)
@@ -175,6 +175,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
 /** @brief Add a "router" to the network element list */
 void sg_platf_new_router(sg_platf_router_cbarg_t router)
 {
+  using simgrid::routing::AsCluster;
   simgrid::routing::AsImpl* current_routing = routing_get_current();
 
   if (current_routing->hierarchy_ == simgrid::routing::AsImpl::RoutingMode::unset)
@@ -205,6 +206,10 @@ void sg_platf_new_router(sg_platf_router_cbarg_t router)
     xbt_lib_set(as_router_lib, router->id, COORD_ASR_LEVEL, (void *) ctn);
   }
 
+  auto cluster = dynamic_cast<AsCluster*>(current_routing);
+  if(cluster != nullptr)
+    cluster->router_ = static_cast<simgrid::routing::NetCard*>(xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL));
+
   if (TRACE_is_enabled() && TRACE_needs_platform())
     sg_instr_new_router(router);
 }
@@ -577,7 +582,8 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process)
   double kill_time  = process->kill_time;
   int auto_restart = process->on_failure == SURF_PROCESS_ON_FAILURE_DIE ? 0 : 1;
 
-  std::function<void()> code = factory(simgrid::xbt::args(process->argc, process->argv));
+  std::vector<std::string> args(process->argv, process->argv + process->argc);
+  std::function<void()> code = factory(std::move(args));
 
   smx_process_arg_t arg = nullptr;
   smx_process_t process_created = nullptr;
@@ -703,7 +709,6 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
   router.id = router_id;
   router.coord = peer->coord;
   sg_platf_new_router(&router);
-  static_cast<AsCluster*>(current_routing)->router_ = static_cast<NetCard*>(xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL));
 
   XBT_DEBUG("</AS>");
   sg_platf_new_AS_seal();