From 9384db270e1d285888021a1c1bb9aad0ae17679c Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 14 Sep 2017 16:07:40 +0200 Subject: [PATCH] New: s4u::Host.execute() for remote executions --- ChangeLog | 1 + include/simgrid/s4u/Host.hpp | 7 +++++++ src/s4u/s4u_host.cpp | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 44c39b1f88..fe4f59923a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ SimGrid (3.17) UNRELEASED (release target: September 22 2017) - Comm.detach(): start and forget about asynchronous emission - this_actor::send(mailbox) is now mailbox->put() - New: simgrid::s4u::Comm::wait_all() + - New: Host.execute() for remote executions. SURF - Unused option network/sender-gap is removed. diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index b27c954e0c..09c55ec295 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -105,6 +105,13 @@ public: void routeTo(Host * dest, std::vector * links, double* latency); void routeTo(Host * dest, std::vector * links, double* latency); + /** Block the calling actor on an execution located on the called host + * + * It is not a problem if the actor is not located on the called host. + * The actor will not be migrated in this case. Such remote execution are easy in simulation. + */ + void execute(double flops); + private: simgrid::xbt::string name_ = "noname"; std::unordered_map* mounts = nullptr; // caching diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 2bb3ab15d5..763fe9841c 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -255,5 +255,14 @@ std::unordered_map const& Host::getMountedStorages() return *mounts; } +void Host::execute(double flops) +{ + Host* host_list[1] = {this}; + double flops_list[1] = {flops}; + smx_activity_t s = simcall_execution_parallel_start(nullptr /*name*/, 1, host_list, flops_list, + nullptr /*comm_sizes */, -1.0, -1 /*timeout*/); + simcall_execution_wait(s); +} + } // namespace simgrid } // namespace s4u -- 2.20.1