Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Split-Duplex: new management
[simgrid.git] / examples / cpp / clusters-multicpu / s4u-clusters-multicpu.cpp
index 88f6053..9feae83 100644 (file)
@@ -110,13 +110,12 @@ create_hostzone(const sg4::NetZone* zone, const std::vector<unsigned int>& /*coo
     /* the first CPU is the gateway */
     if (i == 0)
       gateway = host;
-    /* create 2 links for a full-duplex communication */
-    sg4::Link* link_up   = host_zone->create_link("link-up-" + cpu_name, link_bw)->set_latency(link_lat)->seal();
-    sg4::Link* link_down = host_zone->create_link("link-down-" + cpu_name, link_bw)->set_latency(link_lat)->seal();
-    /* link UP, connection from CPU to outer world */
-    host_zone->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, std::vector<sg4::Link*>{link_up}, false);
-    /* link DOWN, connection from outer to CPU */
-    host_zone->add_route(nullptr, host->get_netpoint(), nullptr, nullptr, std::vector<sg4::Link*>{link_down}, false);
+    /* create split-duplex link */
+    sg4::SplitDuplexLink* link = host_zone->create_split_duplex_link("link-" + cpu_name, link_bw);
+    link->set_latency(link_lat)->seal();
+    /* connecting CPU to outer world */
+    host_zone->add_route(host->get_netpoint(), nullptr, nullptr, nullptr,
+                         std::vector<sg4::LinkInRoute>{{link, sg4::LinkInRoute::Direction::UP}}, true);
   }
   /* seal newly created netzone */
   host_zone->seal();