exec->surf_exec = issuer->host->pimpl_cpu->execution_start(flops_amount);
exec->surf_exec->setData(exec.get());
- exec->surf_exec->setPriority(priority);
+ exec->surf_exec->setSharingWeight(priority);
if (bound > 0)
static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
simgrid::kernel::activity::ExecImplPtr exec =
boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(synchro);
if(exec->surf_exec)
- exec->surf_exec->setPriority(priority);
+ exec->surf_exec->setSharingWeight(priority);
}
void SIMIX_execution_set_bound(smx_activity_t synchro, double bound)
int impact = std::min(active_tasks, ws_vm->pimpl_vm_->coreAmount());
XBT_DEBUG("set the weight of the dummy CPU action of VM%p on PM to %d (#tasks: %d)", ws_vm, impact, active_tasks);
- ws_vm->pimpl_vm_->action_->setPriority(impact);
+ if (impact > 0)
+ ws_vm->pimpl_vm_->action_->setSharingWeight(1. / impact);
+ else
+ ws_vm->pimpl_vm_->action_->setSharingWeight(0.);
}
}
**********/
CpuCas01Action::CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm_constraint_t constraint,
int requestedCore)
- : CpuAction(model, cost, failed, lmm_variable_new(model->getMaxminSystem(), this, 1.0, speed, 1))
+ : CpuAction(model, cost, failed,
+ lmm_variable_new(model->getMaxminSystem(), this, 1.0 / requestedCore, requestedCore * speed, 1))
, requestedCore_(requestedCore)
{
if (model->getUpdateMechanism() == UM_LAZY) {
XBT_OUT();
}
-void CpuTiAction::setPriority(double priority)
+void CpuTiAction::setSharingWeight(double priority)
{
XBT_IN("(%p,%g)", this, priority);
- priority_ = priority;
+ sharingWeight_ = priority;
cpu_->modified(true);
XBT_OUT();
}
void suspend() override;
void resume() override;
void setMaxDuration(double duration) override;
- void setPriority(double priority) override;
+ void setSharingWeight(double priority) override;
double getRemains() override;
CpuTi *cpu_;
s_lmm_element_t *cnsts;
int cnsts_size;
int cnsts_number;
+
// sharing_weight: variable's impact on the resource during the sharing
// if == 0, the variable is not considered by LMM
// on CPU, actions with N threads have a sharing of N
// on network, the actions with higher latency have a lesser sharing_weight
- double sharing_weight; /* weight == 0 -> not considered by LMM; */
+ double sharing_weight;
+
double staged_weight; /* If non-zero, variable is staged for addition as soon as maxconcurrency constraints will be met */
double bound;
double value;
THROW_UNIMPLEMENTED;
}
-void StorageN11Action::setPriority(double /*priority*/)
+void StorageN11Action::setSharingWeight(double /*priority*/)
{
THROW_UNIMPLEMENTED;
}
void resume();
bool isSuspended();
void setMaxDuration(double duration);
- void setPriority(double priority);
+ void setSharingWeight(double priority);
};
}
void Action::gapRemove() {}
-void Action::setPriority(double priority)
+void Action::setSharingWeight(double weight)
{
- XBT_IN("(%p,%g)", this, priority);
- priority_ = priority;
- lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), priority);
+ XBT_IN("(%p,%g)", this, weight);
+ sharingWeight_ = weight;
+ lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), weight);
if (getModel()->getUpdateMechanism() == UM_LAZY)
heapRemove(getModel()->getActionHeap());
lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), 0.0);
if (getModel()->getUpdateMechanism() == UM_LAZY){
heapRemove(getModel()->getActionHeap());
- if (getModel()->getUpdateMechanism() == UM_LAZY && stateSet_ == getModel()->getRunningActionSet() && priority_ > 0){
+ if (getModel()->getUpdateMechanism() == UM_LAZY && stateSet_ == getModel()->getRunningActionSet() &&
+ sharingWeight_ > 0) {
//If we have a lazy model, we need to update the remaining value accordingly
updateRemainingLazy(surf_get_clock());
}
{
XBT_IN("(%p)", this);
if (suspended_ != 2) {
- lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), priority_);
+ lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), sharingWeight_);
suspended_ = 0;
if (getModel()->getUpdateMechanism() == UM_LAZY)
heapRemove(getModel()->getActionHeap());
else
{
xbt_assert(stateSet_ == getModel()->getRunningActionSet(), "You're updating an action that is not running.");
- xbt_assert(priority_ > 0, "You're updating an action that seems suspended.");
+ xbt_assert(sharingWeight_ > 0, "You're updating an action that seems suspended.");
}
delta = now - lastUpdate_;
void setCategory(const char *category);
/** @brief Get the priority of the current Action */
- double getPriority() {return priority_;};
+ double getPriority() { return sharingWeight_; };
/** @brief Set the priority of the current Action */
- virtual void setPriority(double priority);
+ virtual void setSharingWeight(double priority);
/** @brief Get the state set in which the action is */
ActionList* getStateSet() {return stateSet_;};
protected:
ActionList* stateSet_;
- double priority_ = 1.0; /**< priority (1.0 by default) */
+ double sharingWeight_ = 1.0; /**< priority (1.0 by default) */
int refcount_ = 1;
double remains_; /**< How much of that cost remains to be done in the currently running task */
double maxDuration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
XBT_INFO("## Check impact of a single VM collocated with a task (there is no degradation for the moment)");
run_test("( [ ]2 o )2");
- run_test("( [o]2 o )2");
#endif
- run_test("( [oo]2 o )2");
+ run_test("( [o]2 o )2");
#ifdef IGNORE_ME
+ run_test("( [oo]2 o )2");
run_test("( [ooo]2 o )2");
run_test("( [ ]2 oo )2");
run_test("( [o]2 oo )2");