Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simcall_execution_test returns a bool not a state
[simgrid.git] / src / simix / libsmx.cpp
index 16347e9..7116fb0 100644 (file)
@@ -36,9 +36,9 @@ e_smx_state_t simcall_execution_wait(const smx_activity_t& execution)
   return (e_smx_state_t)simcall_BODY_execution_wait(static_cast<simgrid::kernel::activity::ExecImpl*>(execution.get()));
 }
 
-e_smx_state_t simcall_execution_test(const smx_activity_t& execution)
+bool simcall_execution_test(const smx_activity_t& execution)
 {
-  return (e_smx_state_t)simcall_BODY_execution_test(static_cast<simgrid::kernel::activity::ExecImpl*>(execution.get()));
+  return simcall_BODY_execution_test(static_cast<simgrid::kernel::activity::ExecImpl*>(execution.get()));
 }
 
 void simcall_process_join(smx_actor_t process, double timeout)
@@ -110,7 +110,7 @@ smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double
                                   int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                                   void (*clean_fun)(void*),
                                   void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
-                                  void* data, int detached)
+                                  void* data, bool detached)
 {
   /* checking for infinite values */
   xbt_assert(std::isfinite(task_size), "task_size is not finite!");
@@ -384,10 +384,16 @@ smx_activity_t simcall_execution_start(const std::string& name, const std::strin
                                        double priority, double bound, sg_host_t host)
 {
   return simgrid::simix::simcall([name, category, flops_amount, priority, bound, host] {
-    return simgrid::kernel::activity::ExecImplPtr(
-               new simgrid::kernel::activity::ExecImpl(std::move(name), std::move(category)))
-        ->set_host(host)
-        ->start(flops_amount, priority, bound);
+    simgrid::kernel::activity::ExecImpl* exec = new simgrid::kernel::activity::ExecImpl();
+    (*exec)
+        .set_name(name)
+        .set_tracing_category(category)
+        .set_host(host)
+        .set_priority(priority)
+        .set_bound(bound)
+        .set_flops_amount(flops_amount)
+        .start();
+    return simgrid::kernel::activity::ExecImplPtr(exec);
   });
 }
 
@@ -416,19 +422,23 @@ smx_activity_t simcall_execution_parallel_start(const std::string& name, int hos
   }
   xbt_assert(std::isfinite(rate), "rate is not finite!");
 
-  std::vector<simgrid::s4u::Host*> hosts;
+  std::vector<simgrid::s4u::Host*> hosts(host_list, host_list + host_nb);
   std::vector<double> flops_parallel_amount;
   std::vector<double> bytes_parallel_amount;
-  for (int i = 0; i < host_nb; i++) {
-    hosts.push_back(host_list[i]);
-    flops_parallel_amount.push_back(flops_amount[i]);
-    for (int j = 0; j < host_nb; j++)
-      bytes_parallel_amount.push_back(bytes_amount[i]);
-  }
+  if (flops_amount != nullptr)
+    flops_parallel_amount = std::vector<double>(flops_amount, flops_amount + host_nb);
+  if (bytes_amount != nullptr)
+    bytes_parallel_amount = std::vector<double>(bytes_amount, bytes_amount + host_nb * host_nb);
   return simgrid::simix::simcall([name, hosts, flops_parallel_amount, bytes_parallel_amount, timeout] {
-    return simgrid::kernel::activity::ExecImplPtr(new simgrid::kernel::activity::ExecImpl(std::move(name), ""))
-        ->set_timeout(timeout)
-        ->start(hosts, flops_parallel_amount, bytes_parallel_amount);
+    simgrid::kernel::activity::ExecImpl* exec = new simgrid::kernel::activity::ExecImpl();
+    (*exec)
+        .set_name(name)
+        .set_hosts(hosts)
+        .set_timeout(timeout)
+        .set_flops_amounts(flops_parallel_amount)
+        .set_bytes_amounts(bytes_parallel_amount)
+        .start();
+    return simgrid::kernel::activity::ExecImplPtr(exec);
   });
 }