Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
test dependencies with Comm too
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 30 Jan 2020 16:38:42 +0000 (17:38 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 30 Jan 2020 16:42:47 +0000 (17:42 +0100)
ChangeLog
MANIFEST.in
examples/s4u/CMakeLists.txt
examples/s4u/comm-dependent/s4u-comm-dependent.cpp [new file with mode: 0644]
examples/s4u/comm-dependent/s4u-comm-dependent.tesh [new file with mode: 0644]

index acd2d0b..7172f8b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,9 +11,8 @@ Important user-visible changes:
 - SimDAG++: Automatic dependencies on S4U activities (experimental)
   - Some features are already implemented but not all of them
   - Cannot block an activity until it's scheduled on a resource
-  - Only Exec and Io so far. Comms are not handled yet.
-  - No heterogeneous wait_any() that would mix Exec and Io activities.
-  - See examples/s4u/{io-,exec-}dependent for what's already there.
+  - No heterogeneous wait_any() that would mix Exec/Comm/Io activities.
+  - See examples/s4u/{io,exec,comm}-dependent for what's already there.
 
 
 
index 0e36cdd..837ba6a 100644 (file)
@@ -336,6 +336,8 @@ include examples/s4u/cloud-migration/s4u-cloud-migration.cpp
 include examples/s4u/cloud-migration/s4u-cloud-migration.tesh
 include examples/s4u/cloud-simple/s4u-cloud-simple.cpp
 include examples/s4u/cloud-simple/s4u-cloud-simple.tesh
+include examples/s4u/comm-dependent/s4u-comm-dependent.cpp
+include examples/s4u/comm-dependent/s4u-comm-dependent.tesh
 include examples/s4u/dht-chord/s4u-dht-chord-node.cpp
 include examples/s4u/dht-chord/s4u-dht-chord.cpp
 include examples/s4u/dht-chord/s4u-dht-chord.hpp
index 0fb122d..822d01f 100644 (file)
@@ -6,6 +6,7 @@ foreach (example actor-create actor-daemon actor-exiting actor-join actor-kill
                  actor-lifetime actor-migrate actor-suspend actor-yield
                  app-chainsend app-pingpong app-token-ring
                  async-ready async-wait async-waitany async-waitall async-waituntil
+                 comm-dependent
                  cloud-capping cloud-migration cloud-simple
                  energy-exec energy-boot energy-link energy-vm energy-exec-ptask
                  engine-filtering
diff --git a/examples/s4u/comm-dependent/s4u-comm-dependent.cpp b/examples/s4u/comm-dependent/s4u-comm-dependent.cpp
new file mode 100644 (file)
index 0000000..e0a93ce
--- /dev/null
@@ -0,0 +1,52 @@
+/* Copyright (c) 2007-2020. 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. */
+
+#include <simgrid/s4u.hpp>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_comm_dependent, "Messages specific for this s4u example");
+
+static void sender(simgrid::s4u::Mailbox* mailbox)
+{
+  double* computation_amount = new double();
+  *computation_amount        = simgrid::s4u::this_actor::get_host()->get_speed();
+  simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_init(2 * (*computation_amount));
+  simgrid::s4u::CommPtr comm = mailbox->put_init(computation_amount, 7e6);
+
+  exec->set_name("exec on sender")->add_successor(comm)->start();
+  comm->set_name("comm to receiver")->vetoable_start();
+  exec->wait();
+  comm->wait();
+}
+
+static void receiver(simgrid::s4u::Mailbox* mailbox)
+{
+  double received;
+  double computation_amount  = simgrid::s4u::this_actor::get_host()->get_speed();
+  simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_init(2 * computation_amount);
+  simgrid::s4u::CommPtr comm = mailbox->get_init()->set_dst_data((void**)&received);
+
+  comm->set_name("comm from sender")->add_successor(exec)->start();
+  exec->set_name("exec on receiver")->vetoable_start();
+
+  comm->wait();
+  exec->wait();
+}
+
+int main(int argc, char* argv[])
+{
+  simgrid::s4u::Engine e(&argc, argv);
+  e.load_platform(argv[1]);
+
+  simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name("Mailbox");
+
+  simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Tremblay"), sender, mbox);
+  simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("Jupiter"), receiver, mbox);
+
+  e.run();
+
+  XBT_INFO("Simulation time: %.3f", e.get_clock());
+
+  return 0;
+}
diff --git a/examples/s4u/comm-dependent/s4u-comm-dependent.tesh b/examples/s4u/comm-dependent/s4u-comm-dependent.tesh
new file mode 100644 (file)
index 0000000..4b7350f
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env tesh
+
+p Testing with default compound
+
+$ ${bindir:=.}/s4u-comm-dependent ${platfdir}/small_platform.xml  --log=s4u_activity.t:debug "--log=root.fmt:[%6.2r]%e(%i:%P@%h)%e%m%n"
+> [  2.00] (1:sender@Tremblay) Remove a dependency from 'exec on sender' on 'comm to receiver'
+> [  2.00] (1:sender@Tremblay) All dependencies are solved, let's start 'comm to receiver'
+> [  3.07] (2:receiver@Jupiter) Remove a dependency from 'comm from sender' on 'exec on receiver'
+> [  3.07] (2:receiver@Jupiter) All dependencies are solved, let's start 'exec on receiver'
+> [  5.07] (0:maestro@) Simulation time: 5.070