Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics and reduce the amount of direct call to simcall_*
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 11 May 2018 20:50:38 +0000 (22:50 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 11 May 2018 20:50:38 +0000 (22:50 +0200)
include/simgrid/s4u/Host.hpp
src/s4u/s4u_Actor.cpp
src/s4u/s4u_Host.cpp

index 083b80f..d2d2cbf 100644 (file)
@@ -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();
index e67eaa1..ed73dc9 100644 (file)
@@ -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)
index 9b39fd2..97dd8ba 100644 (file)
@@ -257,10 +257,11 @@ std::unordered_map<std::string, Storage*> 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);
 }