Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
further progress towards deprecation of complex add_route
[simgrid.git] / teshsuite / s4u / seal-platform / seal-platform.cpp
index 6d49d7d..d32d2d9 100644 (file)
@@ -6,7 +6,7 @@
 #include "simgrid/s4u.hpp"
 namespace sg4 = simgrid::s4u;
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_torus_multicpu, "Messages specific for this s4u example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(seal_platform, "Messages specific for this s4u example");
 
 class Sender {
   long msg_size = 1e6; /* message size in bytes */
@@ -17,7 +17,7 @@ public:
   void operator()() const
   {
     /* Vector in which we store all ongoing communications */
-    std::vector<sg4::CommPtr> pending_comms;
+    sg4::ActivitySet pending_comms;
     /* Make a vector of the mailboxes to use */
     std::vector<sg4::Mailbox*> mboxes;
 
@@ -28,13 +28,13 @@ public:
       auto* mbox = sg4::Mailbox::by_name(host->get_name());
       mboxes.push_back(mbox);
       sg4::CommPtr comm = mbox->put_async(payload, msg_size);
-      pending_comms.push_back(comm);
+      pending_comms.push(comm);
     }
 
     XBT_INFO("Done dispatching all messages");
 
     /* Now that all message exchanges were initiated, wait for their completion in one single call */
-    sg4::Comm::wait_all(pending_comms);
+    pending_comms.wait_all();
 
     XBT_INFO("Goodbye now!");
   }
@@ -58,17 +58,16 @@ public:
 /*************************************************************************************************/
 static sg4::NetZone* create_zone(const sg4::NetZone* root, const std::string& id)
 {
-  auto* zone = sg4::create_floyd_zone(id);
-  zone->set_parent(root);
+  auto* zone = sg4::create_star_zone(id)->set_parent(root);
   constexpr int n_host = 2;
 
-  auto* router = zone->create_router("router" + id);
+  zone->set_gateway(zone->create_router("router" + id));
   for (int i = 0; i < n_host; i++) {
     std::string hostname = id + "-cpu-" + std::to_string(i);
     auto* host           = zone->create_host(hostname, 1e9);
     host->create_disk("disk-" + hostname, 1e9, 1e6);
     const auto* link = zone->create_link("link-" + hostname, 1e9);
-    zone->add_route(host->get_netpoint(), router, nullptr, nullptr, {link});
+    zone->add_route(host, nullptr, {link});
   }
   return zone;
 }
@@ -84,8 +83,7 @@ int main(int argc, char* argv[])
   auto* zoneA = create_zone(root, "A");
   auto* zoneB = create_zone(root, "B");
   const auto* link = root->create_link("root-link", 1e10);
-  root->add_route(zoneA->get_netpoint(), zoneB->get_netpoint(), e.netpoint_by_name("routerA"),
-                  e.netpoint_by_name("routerB"), {sg4::LinkInRoute(link)});
+  root->add_route(zoneA, zoneB, {sg4::LinkInRoute(link)}, true);
 
   std::vector<sg4::Host*> host_list = e.get_all_hosts();
   /* create the sender actor running on first host */