1 /* Copyright (c) 2006-2022. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include <simgrid/Exception.hpp>
7 #include <simgrid/actor.h>
8 #include <simgrid/modelchecker.h>
9 #include <simgrid/s4u/Actor.hpp>
10 #include <simgrid/s4u/Engine.hpp>
11 #include <simgrid/s4u/Exec.hpp>
12 #include <simgrid/s4u/VirtualMachine.hpp>
14 #include "src/include/mc/mc.h"
15 #include "src/kernel/EngineImpl.hpp"
16 #include "src/kernel/actor/ActorImpl.hpp"
17 #include "src/kernel/context/Context.hpp"
18 #include "src/mc/mc_replay.hpp"
19 #include "src/surf/HostImpl.hpp"
23 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_actor, s4u, "S4U actors");
27 template class xbt::Extendable<s4u::Actor>;
31 xbt::signal<void(Actor&)> s4u::Actor::on_creation;
32 xbt::signal<void(Actor const&)> s4u::Actor::on_suspend;
33 xbt::signal<void(Actor const&)> s4u::Actor::on_resume;
34 xbt::signal<void(Actor const&)> s4u::Actor::on_sleep;
35 xbt::signal<void(Actor const&)> s4u::Actor::on_wake_up;
36 xbt::signal<void(Actor const&, Host const& previous_location)> s4u::Actor::on_host_change;
37 xbt::signal<void(Actor const&)> s4u::Actor::on_termination;
38 xbt::signal<void(Actor const&)> s4u::Actor::on_destruction;
40 // ***** Actor creation *****
43 const kernel::context::Context* self_context = kernel::context::Context::self();
44 if (self_context == nullptr)
47 return self_context->get_actor()->get_ciface();
50 ActorPtr Actor::init(const std::string& name, s4u::Host* host)
52 const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
53 kernel::actor::ActorImpl* actor =
54 kernel::actor::simcall_answered([self, &name, host] { return self->init(name, host).get(); });
55 return actor->get_iface();
58 /** Set a non-default stack size for this context (in Kb)
60 * This must be done before starting the actor, and it won't work with the thread factory. */
61 ActorPtr Actor::set_stacksize(unsigned stacksize)
63 pimpl_->set_stacksize(stacksize * 1024);
67 ActorPtr Actor::start(const std::function<void()>& code)
69 simgrid::kernel::actor::simcall_answered([this, &code] { pimpl_->start(code); });
73 ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::function<void()>& code)
75 const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
76 kernel::actor::ActorImpl* actor =
77 kernel::actor::simcall_answered([self, &name, host, &code] { return self->init(name, host)->start(code); });
79 return actor->get_iface();
82 ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::string& function,
83 std::vector<std::string> args)
85 const simgrid::kernel::actor::ActorCodeFactory& factory =
86 simgrid::kernel::EngineImpl::get_instance()->get_function(function);
87 return create(name, host, factory(std::move(args)));
90 void intrusive_ptr_add_ref(const Actor* actor)
92 intrusive_ptr_add_ref(actor->pimpl_);
94 void intrusive_ptr_release(const Actor* actor)
96 intrusive_ptr_release(actor->pimpl_);
98 int Actor::get_refcount() const
100 return pimpl_->get_refcount();
103 // ***** Actor methods *****
105 void Actor::join() const
110 void Actor::join(double timeout) const
112 kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
113 const kernel::actor::ActorImpl* target = pimpl_;
114 kernel::actor::simcall_blocking([issuer, target, timeout] {
115 if (target->finished_) {
116 // The joined actor is already finished, just wake up the issuer right away
117 issuer->simcall_answer();
119 kernel::activity::ActivityImplPtr sync = issuer->join(target, timeout);
120 sync->register_simcall(&issuer->simcall_);
125 Actor* Actor::set_auto_restart(bool autorestart)
127 kernel::actor::simcall_answered([this, autorestart]() {
128 xbt_assert(autorestart && not pimpl_->has_to_auto_restart()); // FIXME: handle all cases
129 pimpl_->set_auto_restart(autorestart);
131 auto* arg = new kernel::actor::ProcessArg(pimpl_->get_host(), pimpl_);
132 XBT_DEBUG("Adding %s to the actors_at_boot_ list of Host %s", arg->name.c_str(), arg->host->get_cname());
133 pimpl_->get_host()->get_impl()->add_actor_at_boot(arg);
138 void Actor::on_exit(const std::function<void(bool /*failed*/)>& fun) const
140 kernel::actor::simcall_answered([this, &fun] { pimpl_->on_exit->emplace_back(fun); });
143 void Actor::set_host(Host* new_host)
145 const s4u::Host* previous_location = get_host();
147 kernel::actor::simcall_answered([this, new_host]() {
148 for (auto const& activity : pimpl_->activities_) {
149 // FIXME: implement the migration of other kinds of activities
150 if (auto exec = boost::dynamic_pointer_cast<kernel::activity::ExecImpl>(activity))
151 exec->migrate(new_host);
153 this->pimpl_->set_host(new_host);
156 s4u::Actor::on_host_change(*this, *previous_location);
159 s4u::Host* Actor::get_host() const
161 return this->pimpl_->get_host();
164 Actor* Actor::daemonize()
166 kernel::actor::simcall_answered([this]() { pimpl_->daemonize(); });
170 bool Actor::is_daemon() const
172 return this->pimpl_->is_daemon();
175 bool Actor::is_maestro()
177 const auto* self = kernel::actor::ActorImpl::self();
178 return self == nullptr || kernel::EngineImpl::get_instance()->is_maestro(self);
181 const simgrid::xbt::string& Actor::get_name() const
183 return this->pimpl_->get_name();
186 const char* Actor::get_cname() const
188 return this->pimpl_->get_cname();
191 aid_t Actor::get_pid() const
193 return this->pimpl_->get_pid();
196 aid_t Actor::get_ppid() const
198 return this->pimpl_->get_ppid();
201 void Actor::suspend()
203 kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
204 kernel::actor::ActorImpl* target = pimpl_;
205 s4u::Actor::on_suspend(*this);
206 kernel::actor::simcall_blocking([issuer, target]() {
208 if (target != issuer) {
209 /* If we are suspending ourselves, then just do not finish the simcall now */
210 issuer->simcall_answer();
217 kernel::actor::simcall_answered([this] { pimpl_->resume(); });
218 s4u::Actor::on_resume(*this);
221 bool Actor::is_suspended() const
223 return pimpl_->is_suspended();
226 void Actor::set_kill_time(double kill_time)
228 kernel::actor::simcall_answered([this, kill_time] { pimpl_->set_kill_time(kill_time); });
231 /** @brief Get the kill time of an actor(or 0 if unset). */
232 double Actor::get_kill_time() const
234 return pimpl_->get_kill_time();
239 const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
240 kernel::actor::simcall_answered([this, self] { self->kill(pimpl_); });
243 // ***** Static functions *****
245 ActorPtr Actor::by_pid(aid_t pid)
247 kernel::actor::ActorImpl* actor = kernel::actor::ActorImpl::by_pid(pid);
248 if (actor != nullptr)
249 return actor->get_iface();
254 void Actor::kill_all()
256 const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
257 kernel::actor::simcall_answered([self] { self->kill_all(); });
260 const std::unordered_map<std::string, std::string>* Actor::get_properties() const
262 return pimpl_->get_properties();
265 /** Retrieve the property value (or nullptr if not set) */
266 const char* Actor::get_property(const std::string& key) const
268 return pimpl_->get_property(key);
271 void Actor::set_property(const std::string& key, const std::string& value)
273 kernel::actor::simcall_answered([this, &key, &value] { pimpl_->set_property(key, value); });
276 Actor* Actor::restart()
278 return kernel::actor::simcall_answered([this]() { return pimpl_->restart(); });
281 // ***** this_actor *****
283 namespace this_actor {
285 /** Returns true if run from the kernel mode, and false if run from a real actor
287 * Everything that is run out of any actor (simulation setup before the engine is run,
288 * computing the model evolutions as a result to the actors' action, etc) is run in
289 * kernel mode, just as in any operating systems.
291 * In SimGrid, the actor in charge of doing the stuff in kernel mode is called Maestro,
292 * because it is the one scheduling when the others should move or wait.
296 return Actor::is_maestro();
299 void sleep_for(double duration)
301 xbt_assert(std::isfinite(duration), "duration is not finite!");
303 if (duration <= 0) /* that's a no-op */
306 if (duration < sg_surf_precision) {
307 static unsigned int warned = 0; // At most 20 such warnings
310 XBT_INFO("The parameter to sleep_for() is smaller than the SimGrid numerical accuracy (%g < %g). "
311 "Please refer to https://simgrid.org/doc/latest/Configuring_SimGrid.html#numerical-precision",
312 duration, sg_surf_precision);
314 XBT_VERB("(further warnings about the numerical accuracy of sleep_for() will be omitted).");
317 kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
318 Actor::on_sleep(*issuer->get_ciface());
320 kernel::actor::simcall_blocking([issuer, duration]() {
321 if (MC_is_active() || MC_record_replay_is_active()) {
322 MC_process_clock_add(issuer, duration);
323 issuer->simcall_answer();
326 kernel::activity::ActivityImplPtr sync = issuer->sleep(duration);
327 sync->register_simcall(&issuer->simcall_);
330 Actor::on_wake_up(*issuer->get_ciface());
335 kernel::actor::simcall_answered([] { /* do nothing*/ });
338 XBT_PUBLIC void sleep_until(double wakeup_time)
340 double now = s4u::Engine::get_clock();
341 if (wakeup_time > now)
342 sleep_for(wakeup_time - now);
345 void execute(double flops)
347 execute(flops, 1.0 /* priority */);
350 void execute(double flops, double priority)
352 exec_init(flops)->set_priority(priority)->vetoable_start()->wait();
355 void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
356 const std::vector<double>& bytes_amounts)
358 exec_init(hosts, flops_amounts, bytes_amounts)->wait();
361 void thread_execute(s4u::Host* host, double flops_amount, int thread_count)
363 Exec::init()->set_flops_amount(flops_amount)->set_host(host)->set_thread_count(thread_count)->wait();
365 ExecPtr exec_init(double flops_amount)
367 return Exec::init()->set_flops_amount(flops_amount)->set_host(get_host());
370 ExecPtr exec_init(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
371 const std::vector<double>& bytes_amounts)
373 xbt_assert(not hosts.empty(), "Your parallel executions must span over at least one host.");
374 xbt_assert(hosts.size() == flops_amounts.size() || flops_amounts.empty(),
375 "Host count (%zu) does not match flops_amount count (%zu).", hosts.size(), flops_amounts.size());
376 xbt_assert(hosts.size() * hosts.size() == bytes_amounts.size() || bytes_amounts.empty(),
377 "bytes_amounts must be a matrix of size host_count * host_count (%zu*%zu), but it's of size %zu.",
378 hosts.size(), hosts.size(), bytes_amounts.size());
379 /* Check that we are not mixing VMs and PMs in the parallel task */
380 bool is_a_vm = (nullptr != dynamic_cast<VirtualMachine*>(hosts.front()));
381 xbt_assert(std::all_of(hosts.begin(), hosts.end(),
382 [is_a_vm](s4u::Host* elm) {
383 bool tmp_is_a_vm = (nullptr != dynamic_cast<VirtualMachine*>(elm));
384 return is_a_vm == tmp_is_a_vm;
386 "parallel_execute: mixing VMs and PMs is not supported (yet).");
387 /* checking for infinite values */
388 xbt_assert(std::all_of(flops_amounts.begin(), flops_amounts.end(), [](double elm) { return std::isfinite(elm); }),
389 "flops_amounts comprises infinite values!");
390 xbt_assert(std::all_of(bytes_amounts.begin(), bytes_amounts.end(), [](double elm) { return std::isfinite(elm); }),
391 "flops_amounts comprises infinite values!");
393 return Exec::init()->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(hosts);
396 ExecPtr exec_async(double flops)
398 ExecPtr res = exec_init(flops);
399 res->vetoable_start();
405 return simgrid::kernel::actor::ActorImpl::self()->get_pid();
410 return simgrid::kernel::actor::ActorImpl::self()->get_ppid();
413 std::string get_name()
415 return simgrid::kernel::actor::ActorImpl::self()->get_name();
418 const char* get_cname()
420 return simgrid::kernel::actor::ActorImpl::self()->get_cname();
425 return simgrid::kernel::actor::ActorImpl::self()->get_host();
430 kernel::actor::ActorImpl* self = simgrid::kernel::actor::ActorImpl::self();
431 s4u::Actor::on_suspend(*self->get_ciface());
432 kernel::actor::simcall_blocking([self] { self->suspend(); });
437 kernel::actor::ActorImpl* self = simgrid::kernel::actor::ActorImpl::self();
438 simgrid::kernel::actor::simcall_answered([self] { self->exit(); });
442 void on_exit(const std::function<void(bool)>& fun)
444 simgrid::kernel::actor::ActorImpl::self()->get_iface()->on_exit(fun);
447 /** @brief Moves the current actor to another host
449 * @see simgrid::s4u::Actor::migrate() for more information
451 void set_host(Host* new_host)
453 simgrid::kernel::actor::ActorImpl::self()->get_iface()->set_host(new_host);
456 } // namespace this_actor
458 } // namespace simgrid
460 /* **************************** Public C interface *************************** */
461 size_t sg_actor_count()
463 return simgrid::s4u::Engine::get_instance()->get_actor_count();
466 sg_actor_t* sg_actor_list()
468 const simgrid::s4u::Engine* e = simgrid::s4u::Engine::get_instance();
469 size_t actor_count = e->get_actor_count();
470 xbt_assert(actor_count > 0, "There is no actor!");
471 std::vector<simgrid::s4u::ActorPtr> actors = e->get_all_actors();
473 auto* res = xbt_new(sg_actor_t, actors.size());
474 for (size_t i = 0; i < actor_count; i++)
475 res[i] = actors[i].get();
479 sg_actor_t sg_actor_init(const char* name, sg_host_t host)
481 return simgrid::s4u::Actor::init(name, host).get();
484 void sg_actor_start_(sg_actor_t actor, xbt_main_func_t code, int argc, const char* const* argv)
486 simgrid::kernel::actor::ActorCode function;
488 function = simgrid::xbt::wrap_main(code, argc, argv);
489 actor->start(function);
492 sg_actor_t sg_actor_create_(const char* name, sg_host_t host, xbt_main_func_t code, int argc, const char* const* argv)
494 simgrid::kernel::actor::ActorCode function = simgrid::xbt::wrap_main(code, argc, argv);
495 return simgrid::s4u::Actor::init(name, host)->start(function).get();
498 void sg_actor_set_stacksize(sg_actor_t actor, unsigned size)
500 actor->set_stacksize(size);
505 simgrid::s4u::this_actor::exit();
509 * @brief Returns the process ID of @a actor.
511 * This function checks whether @a actor is a valid pointer and return its PID (or 0 in case of problem).
514 aid_t sg_actor_get_pid(const_sg_actor_t actor)
516 /* Do not raise an exception here: this function is called by the logs
517 * and the exceptions, so it would be called back again and again */
518 if (actor == nullptr || actor->get_impl() == nullptr)
520 return actor->get_pid();
524 * @brief Returns the process ID of the parent of @a actor.
526 * This function checks whether @a actor is a valid pointer and return its parent's PID.
527 * Returns -1 if the actor has not been created by any other actor.
529 aid_t sg_actor_get_ppid(const_sg_actor_t actor)
531 return actor->get_ppid();
535 * @brief Return a #sg_actor_t given its PID.
537 * This function search in the list of all the created sg_actor_t for a sg_actor_t whose PID is equal to @a PID.
538 * If none is found, @c nullptr is returned.
539 Note that the PID are unique in the whole simulation, not only on a given host.
541 sg_actor_t sg_actor_by_pid(aid_t pid)
543 return simgrid::s4u::Actor::by_pid(pid).get();
546 /** @brief Return the name of an actor. */
547 const char* sg_actor_get_name(const_sg_actor_t actor)
549 return actor->get_cname();
552 sg_host_t sg_actor_get_host(const_sg_actor_t actor)
554 return actor->get_host();
558 * @brief Returns the value of a given actor property
560 * @param actor an actor
561 * @param name a property name
562 * @return value of a property (or nullptr if the property is not set)
564 const char* sg_actor_get_property_value(const_sg_actor_t actor, const char* name)
566 return actor->get_property(name);
570 * @brief Return the list of properties
572 * This function returns all the parameters associated with an actor
574 xbt_dict_t sg_actor_get_properties(const_sg_actor_t actor)
576 xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
577 xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
578 const std::unordered_map<std::string, std::string>* props = actor->get_properties();
579 if (props == nullptr)
581 for (auto const& kv : *props) {
582 xbt_dict_set(as_dict, kv.first.c_str(), xbt_strdup(kv.second.c_str()));
588 * @brief Suspend the actor.
590 * This function suspends the actor by suspending the task on which it was waiting for the completion.
592 void sg_actor_suspend(sg_actor_t actor)
594 xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
599 * @brief Resume a suspended actor.
601 * This function resumes a suspended actor by resuming the task on which it was waiting for the completion.
603 void sg_actor_resume(sg_actor_t actor)
605 xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
610 * @brief Returns true if the actor is suspended .
612 * This checks whether an actor is suspended or not by inspecting the task on which it was waiting for the completion.
614 int sg_actor_is_suspended(const_sg_actor_t actor)
616 return actor->is_suspended();
619 /** @brief Restarts an actor from the beginning. */
620 sg_actor_t sg_actor_restart(sg_actor_t actor)
622 return actor->restart();
626 * @brief Sets the "auto-restart" flag of the actor.
627 * If the flag is set to 1, the actor will be automatically restarted when its host comes back up.
629 void sg_actor_set_auto_restart(sg_actor_t actor, int auto_restart)
631 actor->set_auto_restart(auto_restart);
634 /** @brief This actor will be terminated automatically when the last non-daemon actor finishes */
635 void sg_actor_daemonize(sg_actor_t actor)
640 /** Returns whether or not this actor has been daemonized or not */
641 int sg_actor_is_daemon(const_sg_actor_t actor)
643 return actor->is_daemon();
647 * @brief Migrates an actor to another location.
649 * This function changes the value of the #sg_host_t on which @a actor is running.
651 void sg_actor_set_host(sg_actor_t actor, sg_host_t host)
653 actor->set_host(host);
657 * @brief Wait for the completion of a #sg_actor_t.
659 * @param actor the actor to wait for
660 * @param timeout wait until the actor is over, or the timeout expires
662 void sg_actor_join(const_sg_actor_t actor, double timeout)
664 actor->join(timeout);
667 void sg_actor_kill(sg_actor_t actor)
672 void sg_actor_kill_all()
674 simgrid::s4u::Actor::kill_all();
678 * @brief Set the kill time of an actor.
680 * @param actor an actor
681 * @param kill_time the time when the actor is killed.
683 void sg_actor_set_kill_time(sg_actor_t actor, double kill_time)
685 actor->set_kill_time(kill_time);
688 /** Yield the current actor; let the other actors execute first */
689 void sg_actor_yield()
691 simgrid::s4u::this_actor::yield();
694 void sg_actor_sleep_for(double duration)
696 simgrid::s4u::this_actor::sleep_for(duration);
699 void sg_actor_sleep_until(double wakeup_time)
701 simgrid::s4u::this_actor::sleep_until(wakeup_time);
704 sg_actor_t sg_actor_attach(const char* name, void* data, sg_host_t host, xbt_dict_t properties)
706 xbt_assert(host != nullptr, "Invalid parameters: host and code params must not be nullptr");
707 std::unordered_map<std::string, std::string> props;
708 xbt_dict_cursor_t cursor = nullptr;
711 xbt_dict_foreach (properties, cursor, key, value)
713 xbt_dict_free(&properties);
715 /* Let's create the actor: SIMIX may decide to start it right now, even before returning the flow control to us */
716 smx_actor_t actor = nullptr;
718 actor = simgrid::kernel::actor::ActorImpl::attach(name, data, host).get();
719 actor->set_properties(props);
720 } catch (simgrid::HostFailureException const&) {
721 xbt_die("Could not attach");
724 simgrid::s4u::this_actor::yield();
725 return actor->get_ciface();
728 void sg_actor_detach()
730 simgrid::kernel::actor::ActorImpl::detach();
733 aid_t sg_actor_self_get_pid()
735 return simgrid::s4u::this_actor::get_pid();
738 aid_t sg_actor_self_get_ppid()
740 return simgrid::s4u::this_actor::get_ppid();
743 const char* sg_actor_self_get_name()
745 return simgrid::s4u::this_actor::get_cname();
748 void* sg_actor_self_get_data()
750 return simgrid::s4u::Actor::self()->get_data<void>();
753 void sg_actor_self_set_data(void* userdata)
755 simgrid::s4u::Actor::self()->set_data(userdata);
758 sg_actor_t sg_actor_self()
760 return simgrid::s4u::Actor::self();
763 void sg_actor_execute(double flops)
765 simgrid::s4u::this_actor::execute(flops);
767 void sg_actor_execute_with_priority(double flops, double priority)
769 simgrid::s4u::this_actor::exec_init(flops)->set_priority(priority)->wait();
772 void sg_actor_parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount)
774 std::vector<simgrid::s4u::Host*> hosts(host_list, host_list + host_nb);
775 std::vector<double> flops;
776 std::vector<double> bytes;
777 if (flops_amount != nullptr)
778 flops = std::vector<double>(flops_amount, flops_amount + host_nb);
779 if (bytes_amount != nullptr)
780 bytes = std::vector<double>(bytes_amount, bytes_amount + host_nb * host_nb);
782 simgrid::s4u::this_actor::parallel_execute(hosts, flops, bytes);
785 /** @brief Take an extra reference on that actor to prevent it to be garbage-collected */
786 void sg_actor_ref(const_sg_actor_t actor)
788 intrusive_ptr_add_ref(actor);
790 /** @brief Release a reference on that actor so that it can get be garbage-collected */
791 void sg_actor_unref(const_sg_actor_t actor)
793 intrusive_ptr_release(actor);
796 /** @brief Return the user data of a #sg_actor_t */
797 void* sg_actor_get_data(const_sg_actor_t actor)
799 return actor->get_data<void>();
802 /** @brief Set the user data of a #sg_actor_t */
803 void sg_actor_set_data(sg_actor_t actor, void* userdata)
805 actor->set_data(userdata);
808 /** @brief Add a function to the list of "on_exit" functions for the current actor.
809 * The on_exit functions are the functions executed when your actor is killed.
810 * You should use them to free the data used by your actor.
812 void sg_actor_on_exit(void_f_int_pvoid_t fun, void* data)
814 simgrid::s4u::this_actor::on_exit([fun, data](bool failed) { fun(failed ? 1 /*FAILURE*/ : 0 /*SUCCESS*/, data); });
817 sg_exec_t sg_actor_exec_init(double computation_amount)
819 simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_init(computation_amount);
824 sg_exec_t sg_actor_parallel_exec_init(int host_nb, const sg_host_t* host_list, double* flops_amount,
825 double* bytes_amount)
827 std::vector<simgrid::s4u::Host*> hosts(host_list, host_list + host_nb);
828 std::vector<double> flops;
829 std::vector<double> bytes;
830 if (flops_amount != nullptr)
831 flops = std::vector<double>(flops_amount, flops_amount + host_nb);
832 if (bytes_amount != nullptr)
833 bytes = std::vector<double>(bytes_amount, bytes_amount + host_nb * host_nb);
835 simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_init(hosts, flops, bytes);
840 sg_exec_t sg_actor_exec_async(double computation_amount)
842 simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_async(computation_amount);