std::vector<double> bytes_amounts_;
std::vector<Host*> hosts_;
bool parallel_ = false;
+ Exec();
public:
- Exec();
~Exec() override = default;
#ifndef DOXYGEN
Exec(Exec const&) = delete;
static xbt::signal<void(Exec const&)> on_start;
static xbt::signal<void(Exec const&)> on_completion;
+ static ExecPtr init();
Exec* start() override;
/** @brief On sequential executions, returns the amount of flops that remain to be done; This cannot be used on
* parallel executions. */
ExecPtr exec_init(double flops_amount)
{
- ExecPtr exec(new Exec());
- exec->set_flops_amount(flops_amount)->set_host(get_host());
- return exec;
+ return Exec::init()->set_flops_amount(flops_amount)->set_host(get_host());
}
ExecPtr exec_init(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
xbt_assert(std::all_of(bytes_amounts.begin(), bytes_amounts.end(), [](double elm) { return std::isfinite(elm); }),
"flops_amounts comprises infinite values!");
- ExecPtr exec(new Exec());
- exec->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(hosts);
- return exec;
+ return Exec::init()->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(hosts);
}
ExecPtr exec_async(double flops)
if (bytes_amount != nullptr)
bytes = std::vector<double>(bytes_amount, bytes_amount + host_nb * host_nb);
- simgrid::s4u::ExecPtr exec(new simgrid::s4u::Exec());
- exec->set_flops_amounts(flops)->set_bytes_amounts(bytes)->set_hosts(hosts);
+ simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_init(hosts, flops, bytes);
exec->add_ref();
return exec.get();
}