- 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.
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
--- /dev/null
+/* 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;
+}
--- /dev/null
+#!/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