Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
another try at cleanly unlocking the mutexes before destroying them in SMPI::RMA
[simgrid.git] / examples / cpp / comm-host2host / s4u-comm-host2host.cpp
index 7c805024f644084dcead714c3902c9ac088b8142..b2c8bbc1df58cb217cfd2ec04e0234b48a51c75f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -12,7 +12,7 @@
    while the _async variant creates and start it. In both cases, you need to wait() it.
 
    It is mostly useful when you want to have a centralized simulation of your settings,
-   with a central actor declaring all communications occuring on your distributed system.
+   with a central actor declaring all communications occurring on your distributed system.
   */
 
 #include <simgrid/s4u.hpp>
@@ -28,12 +28,12 @@ static void sender(sg4::Host* h1, sg4::Host* h2, sg4::Host* h3, sg4::Host* h4)
   auto c12 = sg4::Comm::sendto_async(h1, h2, 1.5e7); // Creates and start a direct communication
 
   auto c34 = sg4::Comm::sendto_init(h3, h4); // Creates but do not start another direct communication
-  c34->set_remaining(1e7);                   // Specify the amount of bytes to exchange in this comm
+  c34->set_payload_size(1e7);                // Specify the amount of bytes to exchange in this comm
 
   // You can also detach() communications that you never plan to test() or wait().
   // Here we create a communication that only slows down the other ones
   auto noise = sg4::Comm::sendto_init(h1, h2);
-  noise->set_remaining(10000);
+  noise->set_payload_size(10000);
   noise->detach();
 
   XBT_INFO("After creation,  c12 is %s (remaining: %.2e bytes); c34 is %s (remaining: %.2e bytes)",
@@ -54,7 +54,7 @@ static void sender(sg4::Host* h1, sg4::Host* h2, sg4::Host* h3, sg4::Host* h4)
   /* As usual, you don't have to explicitly start communications that were just init()ed.
      The wait() will start it automatically. */
   auto c14 = sg4::Comm::sendto_init(h1, h4);
-  c14->set_remaining(100)->wait(); // Chaining 2 operations on this new communication
+  c14->set_payload_size(100)->wait(); // Chaining 2 operations on this new communication
 }
 
 int main(int argc, char* argv[])
@@ -62,12 +62,12 @@ int main(int argc, char* argv[])
   sg4::Engine e(&argc, argv);
   e.load_platform(argv[1]);
 
-  sg4::Actor::create("sender", sg4::Host::by_name("Boivin"), sender, sg4::Host::by_name("Tremblay"),
-                     sg4::Host::by_name("Jupiter"), sg4::Host::by_name("Fafard"), sg4::Host::by_name("Ginette"));
+  sg4::Actor::create("sender", e.host_by_name("Boivin"), sender, e.host_by_name("Tremblay"), e.host_by_name("Jupiter"),
+                     e.host_by_name("Fafard"), e.host_by_name("Ginette"));
 
   e.run();
 
-  XBT_INFO("Total simulation time: %.3f", e.get_clock());
+  XBT_INFO("Total simulation time: %.3f", sg4::Engine::get_clock());
 
   return 0;
 }