if (use_bound) {
if (bound < 1e-12) /* close enough to 0 without any floating precision surprise */
XBT_INFO("bound == 0 means no capping (i.e., unlimited).");
- exec->setBound(bound);
+ exec->set_bound(bound);
}
exec->start();
exec->wait();
{
XBT_INFO("Hello! Execute %g flops with priority %g", computation_amount, priority);
simgrid::s4u::ExecPtr activity = simgrid::s4u::this_actor::exec_init(computation_amount);
- activity->setPriority(priority);
+ activity->set_priority(priority);
activity->start();
activity->wait();
XBT_INFO("I'm a wizard! I can run a task on the Fafard host from the Ginette one! Look!");
simgrid::s4u::ExecPtr exec = simgrid::s4u::this_actor::exec_init(48.492e6);
- exec->setHost(ginette);
+ exec->set_host(ginette);
exec->start();
XBT_INFO("It started. Running 48.492Mf takes exactly one second on Ginette (but not on Fafard).");
XBT_INFO("Done!");
XBT_INFO("And now, harder. Start a remote task on Ginette and move it to Boivin after 0.5 sec");
- exec = simgrid::s4u::this_actor::exec_init(73293500)->setHost(ginette);
+ exec = simgrid::s4u::this_actor::exec_init(73293500)->set_host(ginette);
exec->start();
simgrid::s4u::this_actor::sleep_for(0.5);
XBT_INFO("Loads before the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f",
boivin->getLoad(), fafard->getLoad(), ginette->getLoad());
- exec->setHost(boivin);
+ exec->set_host(boivin);
simgrid::s4u::this_actor::sleep_for(0.1);
XBT_INFO("Loads after the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f",
Activity* wait(double timeout) override;
bool test();
- ExecPtr setPriority(double priority);
- ExecPtr setBound(double bound);
- ExecPtr setHost(Host * host);
- Host* getHost() { return host_; }
+ ExecPtr set_priority(double priority);
+ ExecPtr set_bound(double bound);
+ ExecPtr set_host(Host* host);
+ Host* get_host();
double get_remaining() override;
double getRemainingRatio();
+ //////////////// Deprecated functions
+ XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_priority()") ExecPtr setPriority(double priority)
+ {
+ return set_priority(priority);
+ }
+ XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_bound()") ExecPtr setBound(double bound) { return set_bound(bound); }
+ XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_host()") ExecPtr setHost(Host* host) { return set_host(host); }
+ XBT_ATTRIB_DEPRECATED_v323("Please use Exec::get_host()") Host* getHost() { return get_host(); }
+
private:
Host* host_ = nullptr;
double flops_amount_ = 0.0;
Activity* Exec::start()
{
- pimpl_ = simcall_execution_start(nullptr, flops_amount_, 1 / priority_, 0., host_);
+ pimpl_ = simcall_execution_start(nullptr, flops_amount_, 1. / priority_, 0., host_);
boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(pimpl_)->setBound(bound_);
state_ = State::started;
return this;
return this;
}
+/** @brief Returns whether the state of the exec is finished */
bool Exec::test()
{
xbt_assert(state_ == State::inited || state_ == State::started || state_ == State::finished);
return false;
}
-ExecPtr Exec::setPriority(double priority)
+/** @brief Change the execution priority, don't you think?
+ *
+ * An execution with twice the priority will get twice the amount of flops when the resource is shared.
+ * The default priority is 1.
+ *
+ * Currently, this cannot be changed once the exec started. */
+ExecPtr Exec::set_priority(double priority)
{
xbt_assert(state_ == State::inited, "Cannot change the priority of an exec after its start");
priority_ = priority;
return this;
}
-ExecPtr Exec::setBound(double bound)
+/** @brief change the execution bound, ie the maximal amount of flops per second that it may consume, regardless of what
+ * the host may deliver
+ *
+ * Currently, this cannot be changed once the exec started. */
+ExecPtr Exec::set_bound(double bound)
{
xbt_assert(state_ == State::inited, "Cannot change the bound of an exec after its start");
bound_ = bound;
return this;
}
-ExecPtr Exec::setHost(Host* host)
+/** @brief Change the host on which this activity takes place.
+ *
+ * The activity cannot be terminated already (but it may be started). */
+ExecPtr Exec::set_host(Host* host)
{
xbt_assert(state_ == State::inited || state_ == State::started,
"Cannot change the host of an exec once it's done (state: %d)", (int)state_);
return this;
}
+/** @brief Retrieve the host on which this activity takes place. */
+Host* Exec::get_host()
+{
+ return host_;
+}
+
double Exec::get_remaining()
{
return simgrid::simix::kernelImmediate(