Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add sg_actor_parallel_exec_init()
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 25 Feb 2020 10:51:05 +0000 (11:51 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 25 Feb 2020 10:53:13 +0000 (11:53 +0100)
include/simgrid/actor.h
src/s4u/s4u_Actor.cpp

index b006a24..220b449 100644 (file)
@@ -73,6 +73,8 @@ XBT_PUBLIC void* sg_actor_data(const_sg_actor_t actor);
 XBT_PUBLIC void sg_actor_data_set(sg_actor_t actor, void* userdata);
 
 XBT_PUBLIC sg_exec_t sg_actor_exec_init(double computation_amount);
+XBT_PUBLIC sg_exec_t sg_actor_parallel_exec_init(int host_nb, const sg_host_t* host_list, double* flops_amount,
+                                                 double* bytes_amount);
 XBT_PUBLIC sg_exec_t sg_actor_exec_async(double computation_amount);
 SG_END_DECL
 
index b539dbd..aaa8686 100644 (file)
@@ -799,6 +799,23 @@ sg_exec_t sg_actor_exec_init(double computation_amount)
   return exec.get();
 }
 
+sg_exec_t sg_actor_parallel_exec_init(int host_nb, const sg_host_t* host_list, double* flops_amount,
+                                      double* bytes_amount)
+{
+  std::vector<simgrid::s4u::Host*> hosts(host_list, host_list + host_nb);
+  std::vector<double> flops;
+  std::vector<double> bytes;
+  if (flops_amount != nullptr)
+    flops = std::vector<double>(flops_amount, flops_amount + host_nb);
+  if (bytes_amount != nullptr)
+    bytes = std::vector<double>(bytes_amount, bytes_amount + host_nb * host_nb);
+
+  simgrid::s4u::ExecPtr exec = simgrid::s4u::ExecPtr(new simgrid::s4u::Exec());
+  exec->set_flops_amounts(flops)->set_bytes_amounts(bytes)->set_hosts(hosts);
+  exec->add_ref();
+  return exec.get();
+}
+
 sg_exec_t sg_actor_exec_async(double computation_amount)
 {
   simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_async(computation_amount);