Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanups after introduction of Exec::wait_for(timeout)
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 12 Dec 2019 20:19:47 +0000 (21:19 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 12 Dec 2019 20:19:47 +0000 (21:19 +0100)
examples/s4u/exec-ptask/s4u-exec-ptask.cpp
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Exec.hpp
src/msg/msg_task.cpp
src/s4u/s4u_Actor.cpp
src/s4u/s4u_Exec.cpp
src/smpi/plugins/sampi_loadbalancer.cpp

index 146753e..468c94e 100644 (file)
@@ -52,8 +52,8 @@ static void runner()
       communication_amounts[i * hosts_count + j] = 1e7; // 10 MB
 
   try {
       communication_amounts[i * hosts_count + j] = 1e7; // 10 MB
 
   try {
-    simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts,
-                                               10.0 /* timeout (in seconds)*/);
+    simgrid::s4u::this_actor::exec_init(hosts, computation_amounts, communication_amounts)
+        ->wait_for(10.0 /* timeout (in seconds)*/);
     xbt_die("Woops, this did not timeout as expected... Please report that bug.");
   } catch (const simgrid::TimeoutException&) {
     XBT_INFO("Caught the expected timeout exception.");
     xbt_die("Woops, this did not timeout as expected... Please report that bug.");
   } catch (const simgrid::TimeoutException&) {
     XBT_INFO("Caught the expected timeout exception.");
index ca1183e..901caf4 100644 (file)
@@ -308,12 +308,13 @@ XBT_PUBLIC void execute(double flop, double priority);
  *
  * \endrst
  */
  *
  * \endrst
  */
+/** Block the current actor until the built parallel execution completes */
 XBT_PUBLIC void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
                                  const std::vector<double>& bytes_amounts);
 
 XBT_PUBLIC void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
                                  const std::vector<double>& bytes_amounts);
 
-/** Block the current actor until the built parallel execution completes, or until the timeout. */
-XBT_PUBLIC void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
-                                 const std::vector<double>& bytes_amounts, double timeout);
+XBT_ATTRIB_DEPRECATED_v329("Please use exec_init(...)->wait_for(timeout)") XBT_PUBLIC
+    void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
+                          const std::vector<double>& bytes_amounts, double timeout);
 
 /** Initialize a sequential execution that must then be started manually */
 XBT_PUBLIC ExecPtr exec_init(double flops_amounts);
 
 /** Initialize a sequential execution that must then be started manually */
 XBT_PUBLIC ExecPtr exec_init(double flops_amounts);
index 5a65e18..466c950 100644 (file)
@@ -55,7 +55,7 @@ public:
 
   ExecPtr set_bound(double bound);
   ExecPtr set_priority(double priority);
 
   ExecPtr set_bound(double bound);
   ExecPtr set_priority(double priority);
-  ExecPtr set_timeout(double timeout);
+  XBT_ATTRIB_DEPRECATED_v329("Please use exec_init(...)->wait_for(timeout)") ExecPtr set_timeout(double timeout);
   Exec* cancel() override;
   Host* get_host() const;
   unsigned int get_host_number() const;
   Exec* cancel() override;
   Host* get_host() const;
   unsigned int get_host_number() const;
index 9343108..24cbd4b 100644 (file)
@@ -75,10 +75,9 @@ msg_error_t Task::execute()
 
     compute->set_name(name_)
         ->set_tracing_category(tracing_category_)
 
     compute->set_name(name_)
         ->set_tracing_category(tracing_category_)
-        ->set_timeout(timeout_)
         ->set_priority(1 / priority_)
         ->set_bound(bound_)
         ->set_priority(1 / priority_)
         ->set_bound(bound_)
-        ->wait();
+        ->wait_for(timeout_);
 
     set_not_used();
     XBT_DEBUG("Execution task '%s' finished", get_cname());
 
     set_not_used();
     XBT_DEBUG("Execution task '%s' finished", get_cname());
index e0768d8..f1ae946 100644 (file)
@@ -349,7 +349,7 @@ void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<do
 }
 
 void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
 }
 
 void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
-                      const std::vector<double>& bytes_amounts, double timeout)
+                      const std::vector<double>& bytes_amounts, double timeout) // XBT_ATTRIB_DEPRECATED_v329
 {
   exec_init(hosts, flops_amounts, bytes_amounts)->wait_for(timeout);
 }
 {
   exec_init(hosts, flops_amounts, bytes_amounts)->wait_for(timeout);
 }
index 66016d3..cd5c6d5 100644 (file)
@@ -78,7 +78,7 @@ ExecPtr Exec::set_bound(double bound)
   bound_ = bound;
   return this;
 }
   bound_ = bound;
   return this;
 }
-ExecPtr Exec::set_timeout(double timeout)
+ExecPtr Exec::set_timeout(double timeout) // XBT_ATTRIB_DEPRECATED_v329
 {
   xbt_assert(state_ == State::INITED, "Cannot change the bound of an exec after its start");
   timeout_ = timeout;
 {
   xbt_assert(state_ == State::INITED, "Cannot change the bound of an exec after its start");
   timeout_ = timeout;
index 5e928f2..78b9527 100644 (file)
@@ -86,7 +86,7 @@ public:
 
       xbt_os_timer_t timer = smpi_process()->timer();
       xbt_os_threadtimer_start(timer);
 
       xbt_os_timer_t timer = smpi_process()->timer();
       xbt_os_threadtimer_start(timer);
-      simgrid::s4u::this_actor::parallel_execute(migration_hosts, comp_amount, comm_amount, -1.0);
+      simgrid::s4u::this_actor::parallel_execute(migration_hosts, comp_amount, comm_amount);
       xbt_os_threadtimer_stop(timer);
       smpi_execute(xbt_os_timer_elapsed(timer));
 
       xbt_os_threadtimer_stop(timer);
       smpi_execute(xbt_os_timer_elapsed(timer));