/** @brief Set the tracing category of the current Action */
void set_category(const std::string& category) { category_ = category; }
- /** @brief Get the priority of the current Action */
- double get_priority() const { return sharing_priority_; };
- /** @brief Set the priority of the current Action */
- virtual void set_priority(double priority);
- void set_priority_no_update(double priority) { sharing_priority_ = priority; }
+ /** @brief Get the sharing_penalty (RTT or 1/thread_count) of the current Action */
+ double get_sharing_penalty() const { return sharing_penalty_; };
+ /** @brief Set the sharing_penalty (RTT or 1/thread_count) of the current Action */
+ virtual void set_sharing_penalty(double sharing_penalty);
+ void set_sharing_penalty_no_update(double sharing_penalty) { sharing_penalty_ = sharing_penalty; }
/** @brief Get the state set in which the action is */
StateSet* get_state_set() const { return state_set_; };
StateSet* state_set_;
Action::SuspendStates suspended_ = Action::SuspendStates::RUNNING;
int refcount_ = 1;
- double sharing_priority_ = 1.0; /**< priority (1.0 by default) */
+ double sharing_penalty_ = 1.0; /**< priority (1.0 by default) */
double max_duration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
double remains_; /**< How much of that cost remains to be done in the currently running task */
double start_time_; /**< start time */
XBT_ATTRIB_DEPRECATED_v325("Please use Exec::cancel()") XBT_PUBLIC
void simcall_execution_cancel(smx_activity_t execution);
-XBT_ATTRIB_DEPRECATED_v325("Please use Exec::set_priority()") XBT_PUBLIC
- void simcall_execution_set_priority(smx_activity_t execution, double priority);
XBT_ATTRIB_DEPRECATED_v325("Please use Exec::set_bound()") XBT_PUBLIC
void simcall_execution_set_bound(smx_activity_t execution, double bound);
SG_END_DECL()
#ifdef __cplusplus
XBT_ATTRIB_DEPRECATED_v325("Please use Exec::start()") XBT_PUBLIC smx_activity_t
- simcall_execution_start(const std::string& name, const std::string& category, double flops_amount, double priority,
- double bound, sg_host_t host);
+ simcall_execution_start(const std::string& name, const std::string& category, double flops_amount,
+ double sharing_penalty, double bound, sg_host_t host);
// Should be deprecated in v325 too but is still used in other deprecated calls
XBT_PUBLIC smx_activity_t simcall_execution_parallel_start(const std::string& name, int host_nb,
if (not MC_is_active() && not MC_record_replay_is_active()) {
if (hosts_.size() == 1) {
surf_action_ = hosts_.front()->pimpl_cpu->execution_start(flops_amounts_.front());
- surf_action_->set_priority(priority_);
+ surf_action_->set_sharing_penalty(sharing_penalty_);
surf_action_->set_category(get_tracing_category());
if (bound_ > 0)
return *this;
}
-ExecImpl& ExecImpl::set_priority(double priority)
+ExecImpl& ExecImpl::set_sharing_penalty(double sharing_penalty)
{
- priority_ = priority;
+ sharing_penalty_ = sharing_penalty;
return *this;
}
resource::Action* new_action = to->pimpl_cpu->execution_start(old_action->get_cost());
new_action->set_remains(old_action->get_remains());
new_action->set_activity(this);
- new_action->set_priority(old_action->get_priority());
+ new_action->set_sharing_penalty(old_action->get_sharing_penalty());
// FIXME: the user-defined bound seem to not be kept by LMM, that seem to overwrite it for the multi-core modeling.
// I hope that the user did not provide any.
class XBT_PUBLIC ExecImpl : public ActivityImpl_T<ExecImpl> {
resource::Action* timeout_detector_ = nullptr;
- double priority_ = 1.0;
+ double sharing_penalty_ = 1.0;
double bound_ = 0.0;
std::vector<s4u::Host*> hosts_;
std::vector<double> flops_amounts_;
public:
ExecImpl& set_timeout(double timeout);
ExecImpl& set_bound(double bound);
- ExecImpl& set_priority(double priority);
+ ExecImpl& set_sharing_penalty(double sharing_penalty);
ExecImpl& set_flops_amount(double flop_amount);
ExecImpl& set_host(s4u::Host* host);
get_model()->get_action_heap().remove(this);
}
-void Action::set_priority(double weight)
+void Action::set_sharing_penalty(double sharing_penalty)
{
- XBT_IN("(%p,%g)", this, weight);
- sharing_priority_ = weight;
- get_model()->get_maxmin_system()->update_variable_weight(get_variable(), weight);
+ XBT_IN("(%p,%g)", this, sharing_penalty);
+ sharing_penalty_ = sharing_penalty;
+ get_model()->get_maxmin_system()->update_variable_weight(get_variable(), sharing_penalty);
if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY)
get_model()->get_action_heap().remove(this);
get_model()->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) {
get_model()->get_action_heap().remove(this);
- if (state_set_ == get_model()->get_started_action_set() && sharing_priority_ > 0) {
+ if (state_set_ == get_model()->get_started_action_set() && sharing_penalty_ > 0) {
// If we have a lazy model, we need to update the remaining value accordingly
update_remains_lazy(surf_get_clock());
}
{
XBT_IN("(%p)", this);
if (suspended_ != SuspendStates::SLEEPING) {
- get_model()->get_maxmin_system()->update_variable_weight(get_variable(), get_priority());
+ get_model()->get_maxmin_system()->update_variable_weight(get_variable(), get_sharing_penalty());
suspended_ = SuspendStates::RUNNING;
if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY)
get_model()->get_action_heap().remove(this);
continue;
/* bogus priority, skip it */
- if (action->get_priority() <= 0 || action->get_type() == ActionHeap::Type::latency)
+ if (action->get_sharing_penalty() <= 0 || action->get_type() == ActionHeap::Type::latency)
continue;
action->update_remains_lazy(now);
XBT_DEBUG("set the weight of the dummy CPU action of VM%p on PM to %d (#tasks: %d)", this, impact, active_tasks_);
if (impact > 0)
- action_->set_priority(1. / impact);
+ action_->set_sharing_penalty(1. / impact);
else
- action_->set_priority(0.);
+ action_->set_sharing_penalty(0.);
action_->set_bound(std::min(impact * physical_host_->get_speed(), user_bound_));
}
(*boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_))
.set_name(name_)
.set_tracing_category(tracing_category_)
- .set_priority(1. / priority_)
+ .set_sharing_penalty(1. / priority_)
.set_bound(bound_)
.set_flops_amount(flops_amount_)
.start();
[this]() { return boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(pimpl_)->get_remaining(); });
}
-/** @brief Returns the ratio of elements that are still to do
+/** @brief Returns the ratio of elements that are still to do
*
* The returned value is between 0 (completely done) and 1 (nothing done yet).
*/
{
simgrid::simix::simcall([exec] { boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(exec)->cancel(); });
}
-void simcall_execution_set_priority(smx_activity_t exec, double priority)
-{
- simgrid::simix::simcall([exec, priority] {
- boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(exec)->set_priority(priority);
- });
-}
void simcall_execution_set_bound(smx_activity_t exec, double bound)
{
// deprecated
smx_activity_t simcall_execution_start(const std::string& name, const std::string& category, double flops_amount,
- double priority, double bound, sg_host_t host)
+ double sharing_penalty, double bound, sg_host_t host)
{
- return simgrid::simix::simcall([name, category, flops_amount, priority, bound, host] {
+ return simgrid::simix::simcall([name, category, flops_amount, sharing_penalty, bound, host] {
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_sharing_penalty(sharing_penalty)
.set_bound(bound)
.set_flops_amount(flops_amount)
.start();
{
xbt_assert(get_state_set() == get_model()->get_started_action_set(),
"You're updating an action that is not running.");
- xbt_assert(get_priority() > 0, "You're updating an action that seems suspended.");
+ xbt_assert(get_sharing_penalty() > 0, "You're updating an action that seems suspended.");
double delta = now - get_last_update();
continue;
/* bogus priority, skip it */
- if (action.get_priority() <= 0)
+ if (action.get_sharing_penalty() <= 0)
continue;
/* action suspended, skip it */
if (not action.is_running())
continue;
- sum_priority_ += 1.0 / action.get_priority();
+ sum_priority_ += 1.0 / action.get_sharing_penalty();
}
for (CpuTiAction& action : action_set_) {
continue;
/* verify if the action is really running on cpu */
- if (action.is_running() && action.get_priority() > 0) {
+ if (action.is_running() && action.get_sharing_penalty() > 0) {
/* total area needed to finish the action. Used in trace integration */
- double total_area = (action.get_remains() * sum_priority_ * action.get_priority()) / speed_.peak;
+ double total_area = (action.get_remains() * sum_priority_ * action.get_sharing_penalty()) / speed_.peak;
action.set_finish_time(speed_integrated_trace_->solve(now, total_area));
/* verify which event will happen before (max_duration or finish time) */
continue;
/* bogus priority, skip it */
- if (action.get_priority() <= 0)
+ if (action.get_sharing_penalty() <= 0)
continue;
/* action suspended, skip it */
continue;
/* update remaining */
- action.update_remains(area_total / (sum_priority_ * action.get_priority()));
+ action.update_remains(area_total / (sum_priority_ * action.get_sharing_penalty()));
XBT_DEBUG("Update remaining action(%p) remaining %f", &action, action.get_remains_no_update());
}
last_update_ = now;
XBT_OUT();
}
-void CpuTiAction::set_priority(double priority)
+void CpuTiAction::set_sharing_penalty(double sharing_penalty)
{
- XBT_IN("(%p,%g)", this, priority);
- set_priority_no_update(priority);
+ XBT_IN("(%p,%g)", this, sharing_penalty);
+ set_sharing_penalty_no_update(sharing_penalty);
cpu_->set_modified(true);
XBT_OUT();
}
void suspend() override;
void resume() override;
void set_max_duration(double duration) override;
- void set_priority(double priority) override;
+ void set_sharing_penalty(double sharing_penalty) override;
double get_remains() override;
CpuTi *cpu_;
THROW_UNIMPLEMENTED;
}
-void StorageN11Action::set_priority(double /*priority*/)
+void StorageN11Action::set_sharing_penalty(double)
{
THROW_UNIMPLEMENTED;
}
void cancel() override;
void resume() override;
void set_max_duration(double duration) override;
- void set_priority(double priority) override;
+ void set_sharing_penalty(double sharing_penalty) override;
void update_remains_lazy(double now) override;
};