Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
modernize cabinet creation
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 12 Apr 2021 13:10:49 +0000 (15:10 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 12 Apr 2021 13:10:49 +0000 (15:10 +0200)
src/surf/sg_platf.cpp

index 1f4eb20..1e41058 100644 (file)
@@ -265,27 +265,17 @@ void routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl* bb)
 
 void sg_platf_new_cabinet(const simgrid::kernel::routing::CabinetCreationArgs* cabinet)
 {
+  auto* zone = static_cast<simgrid::kernel::routing::ClusterZone*>(routing_get_current());
   for (int const& radical : *cabinet->radicals) {
-    std::string hostname = cabinet->prefix + std::to_string(radical) + cabinet->suffix;
-    simgrid::kernel::routing::HostCreationArgs host;
-    host.pstate      = 0;
-    host.core_amount = 1;
-    host.id          = hostname;
-    host.speed_per_pstate.push_back(cabinet->speed);
-    sg_platf_new_host(&host);
-
-    simgrid::kernel::routing::LinkCreationArgs link;
-    link.policy  = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
-    link.latency = cabinet->lat;
-    link.bandwidths.push_back(cabinet->bw);
-    link.id = "link_" + hostname;
-    sg_platf_new_link(&link);
-
-    simgrid::kernel::routing::HostLinkCreationArgs host_link;
-    host_link.id        = hostname;
-    host_link.link_up   = std::string("link_") + hostname + "_UP";
-    host_link.link_down = std::string("link_") + hostname + "_DOWN";
-    sg_platf_new_hostlink(&host_link);
+    std::string id           = cabinet->prefix + std::to_string(radical) + cabinet->suffix;
+    simgrid::s4u::Host* host = zone->create_host(id, std::vector<double>{cabinet->speed})->seal();
+
+    simgrid::s4u::Link* link_up =
+        zone->create_link("link_" + id + "_UP", std::vector<double>{cabinet->bw})->set_latency(cabinet->lat)->seal();
+    simgrid::s4u::Link* link_down =
+        zone->create_link("link_" + id + "_DOWN", std::vector<double>{cabinet->bw})->set_latency(cabinet->lat)->seal();
+
+    zone->add_private_link_at(host->get_netpoint()->id(), {link_up->get_impl(), link_down->get_impl()});
   }
   delete cabinet->radicals;
 }