static void worker(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
{
XBT_INFO("Let's do some work (for 10 sec on Boivin).");
- sg_actor_self_execute(980.95e6);
+ sg_actor_execute(980.95e6);
XBT_INFO("I'm done now. I leave even if it makes the daemon die.");
}
// Register a lambda function to be executed once it stops
sg_actor_on_exit(&my_on_exit, NULL);
- sg_actor_self_execute(1e9);
+ sg_actor_execute(1e9);
}
int main(int argc, char* argv[])
XBT_INFO("Suspending myself");
sg_actor_suspend(sg_actor_self()); /* - First suspend itself */
XBT_INFO("OK, OK. Let's work"); /* - Then is resumed and start to execute a task */
- sg_actor_self_execute(1e9);
+ sg_actor_execute(1e9);
XBT_INFO("Bye!"); /* - But will never reach the end of it */
}
argv[2]);
sg_actor_set_host(sg_actor_self(), first);
- sg_actor_self_execute(flopAmount);
+ sg_actor_execute(flopAmount);
XBT_INFO("I wake up on %s. Let's suspend a bit", sg_host_get_name(sg_host_self()));
XBT_INFO("Waking up once for all!");
XBT_INFO("Ok, let's do some work, then (for 10 sec on Boivin).");
- sg_actor_self_execute(980.95e6);
+ sg_actor_execute(980.95e6);
XBT_INFO("Mmmh, I'm done now. Goodbye.");
}
const char* host_name = sg_host_get_name(sg_host_self());
double clock_sta = simgrid_get_clock();
- sg_actor_self_execute(1000000);
+ sg_actor_execute(1000000);
double clock_end = simgrid_get_clock();
XBT_INFO("%s:%s task executed %g", host_name, pr_name, clock_end - clock_sta);
// Run a task
start = simgrid_get_clock();
XBT_INFO("Run a task of %.0E flops", 100E6);
- sg_actor_self_execute(100E6);
+ sg_actor_execute(100E6);
XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW"
" depending on load; Energy dissipated=%.0f J",
simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_wattmin_at(host, sg_host_get_pstate(host)),
// Run a second task
start = simgrid_get_clock();
XBT_INFO("Run a task of %.0E flops", 100E6);
- sg_actor_self_execute(100E6);
+ sg_actor_execute(100E6);
XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_consumed_energy(host));
static void worker_func(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
{
- sg_actor_self_execute(300E6);
+ sg_actor_execute(300E6);
XBT_INFO("This worker is done.");
}
double current_peak = sg_host_speed(host);
XBT_INFO("Current power peak=%f", current_peak);
- sg_actor_self_execute(100E6);
+ sg_actor_execute(100E6);
double task_time = simgrid_get_clock();
XBT_INFO("Task1 simulation time: %e", task_time);
current_peak = sg_host_speed(host);
XBT_INFO("Current power peak=%f", current_peak);
- sg_actor_self_execute(100E6);
+ sg_actor_execute(100E6);
task_time = simgrid_get_clock() - task_time;
XBT_INFO("Task2 simulation time: %e", task_time);
// Run a task
start = simgrid_get_clock();
XBT_INFO("Run a task of %.0E flops at current speed of %.0E flop/s", 200e6, sg_host_speed(host));
- sg_actor_self_execute(200e6);
+ sg_actor_execute(200e6);
XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s (when I started the computation, "
"the speed was set to %.0E flop/s); number of flops computed so "
// Run a second task
start = simgrid_get_clock();
XBT_INFO("Run a task of %.0E flops", 100e6);
- sg_actor_self_execute(100e6);
+ sg_actor_execute(100e6);
XBT_INFO("Done working on my task; this took %.2fs; current peak speed: %.0E flop/s; number of flops computed so "
"far: %.2E",
simgrid_get_clock() - start, sg_host_speed(host), sg_host_get_computed_flops(host));
XBT_PUBLIC const char* sg_actor_self_get_name();
XBT_PUBLIC void* sg_actor_self_data();
XBT_PUBLIC void sg_actor_self_data_set(void* data);
-XBT_PUBLIC void sg_actor_self_execute(double flops);
+XBT_ATTRIB_DEPRECATED_v330("Please use sg_actor_execute() instead") XBT_PUBLIC void sg_actor_self_execute(double flops);
+XBT_PUBLIC void sg_actor_execute(double flops);
+void sg_actor_parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount);
XBT_PUBLIC void sg_actor_ref(const_sg_actor_t actor);
XBT_PUBLIC void sg_actor_unref(const_sg_actor_t actor);
XBT_PUBLIC void* sg_actor_data(const_sg_actor_t actor);
return simgrid::s4u::Actor::self();
}
-void sg_actor_self_execute(double flops)
+void sg_actor_self_execute(double flops) // XBT_DEPRECATED_v330
{
simgrid::s4u::this_actor::execute(flops);
}
+void sg_actor_execute(double flops)
+{
+ simgrid::s4u::this_actor::execute(flops);
+}
+
+void sg_actor_parallel_execute(int host_nb, 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::this_actor::parallel_execute(hosts, flops, bytes);
+}
+
/** @brief Take an extra reference on that actor to prevent it to be garbage-collected */
void sg_actor_ref(const_sg_actor_t actor)
{