From: Martin Quinson Date: Fri, 11 May 2018 20:50:38 +0000 (+0200) Subject: cosmetics and reduce the amount of direct call to simcall_* X-Git-Tag: v3.20~243 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7bf534517bd8b098dbaa58fe26076746176f1399 cosmetics and reduce the amount of direct call to simcall_* --- diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index 083b80fdc9..d2d2cbf9d2 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -119,6 +119,8 @@ public: * The actor will not be migrated in this case. Such remote execution are easy in simulation. */ void execute(double flops); + /** Block the calling actor on an execution located on the called host (with explicit priority) */ + void execute(double flops, double priority); /** @brief Returns the current computation load (in flops per second) */ double getLoad(); diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index e67eaa10f3..ed73dc983a 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -270,27 +270,24 @@ XBT_PUBLIC void sleep_until(double timeout) void execute(double flops) { - smx_activity_t s = simcall_execution_start(nullptr, flops, 1.0 /*priority*/, 0. /*bound*/, get_host()); - simcall_execution_wait(s); + get_host()->execute(flops); } void execute(double flops, double priority) { - smx_activity_t s = simcall_execution_start(nullptr, flops, 1 / priority /*priority*/, 0. /*bound*/, get_host()); - simcall_execution_wait(s); + get_host()->execute(flops, priority); } -void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double timeout) +void parallel_execute(int host_nb, s4u::Host** host_list, double* flops_amount, double* bytes_amount, double timeout) { smx_activity_t s = - simcall_execution_parallel_start(nullptr, host_nb, host_list, flops_amount, bytes_amount, -1, timeout); + simcall_execution_parallel_start(nullptr, host_nb, host_list, flops_amount, bytes_amount, /* rate */ -1, timeout); simcall_execution_wait(s); } void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount) { - smx_activity_t s = simcall_execution_parallel_start(nullptr, host_nb, host_list, flops_amount, bytes_amount, -1, -1); - simcall_execution_wait(s); + parallel_execute(host_nb, host_list, flops_amount, bytes_amount, /* timeout */ -1); } ExecPtr exec_init(double flops_amount) diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 9b39fd2e66..97dd8ba2a1 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -257,10 +257,11 @@ std::unordered_map const& Host::getMountedStorages() 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*/); + execute(flops, 1.0 /* priority */); +} +void Host::execute(double flops, double priority) +{ + smx_activity_t s = simcall_execution_start(nullptr, flops, 1 / priority /*priority*/, 0. /*bound*/, this); simcall_execution_wait(s); }