public:
/** @brief Possible update mechanisms */
enum class UpdateAlgo {
- Full, /**< Full update mechanism: the remaining time of every action is recomputed at each step */
- Lazy /**< Lazy update mechanism: only the modified actions get recomputed.
+ FULL, /**< Full update mechanism: the remaining time of every action is recomputed at each step */
+ LAZY /**< Lazy update mechanism: only the modified actions get recomputed.
It may be slower than full if your system is tightly coupled to the point where every action
gets recomputed anyway. In that case, you'd better not try to be cleaver with lazy and go for
a simple full update. */
if (variable_)
get_model()->get_maxmin_system()->update_variable_bound(variable_, bound);
- if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy && get_last_update() != surf_get_clock())
+ if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY && get_last_update() != surf_get_clock())
get_model()->get_action_heap().remove(this);
XBT_OUT();
}
void Action::set_max_duration(double duration)
{
max_duration_ = duration;
- if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) // remove action from the heap
+ if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) // remove action from the heap
get_model()->get_action_heap().remove(this);
}
sharing_priority_ = weight;
get_model()->get_maxmin_system()->update_variable_weight(get_variable(), weight);
- if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy)
+ if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY)
get_model()->get_action_heap().remove(this);
XBT_OUT();
}
void Action::cancel()
{
set_state(Action::State::FAILED);
- if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) {
+ if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) {
if (modified_set_hook_.is_linked())
simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this);
get_model()->get_action_heap().remove(this);
XBT_IN("(%p)", this);
if (suspended_ != SuspendStates::sleeping) {
get_model()->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
- if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) {
+ 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 we have a lazy model, we need to update the remaining value accordingly
if (suspended_ != SuspendStates::sleeping) {
get_model()->get_maxmin_system()->update_variable_weight(get_variable(), get_priority());
suspended_ = SuspendStates::not_suspended;
- if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy)
+ if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY)
get_model()->get_action_heap().remove(this);
}
XBT_OUT();
{
XBT_IN("(%p)", this);
/* update remains before return it */
- if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) /* update remains before return it */
+ if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) /* update remains before return it */
update_remains_lazy(surf_get_clock());
XBT_OUT();
return remains_;
double Model::next_occuring_event(double now)
{
// FIXME: set the good function once and for all
- if (update_algorithm_ == Model::UpdateAlgo::Lazy)
+ if (update_algorithm_ == Model::UpdateAlgo::LAZY)
return next_occuring_event_lazy(now);
- else if (update_algorithm_ == Model::UpdateAlgo::Full)
+ else if (update_algorithm_ == Model::UpdateAlgo::FULL)
return next_occuring_event_full(now);
else
xbt_die("Invalid cpu update mechanism!");
void Model::update_actions_state(double now, double delta)
{
- if (update_algorithm_ == Model::UpdateAlgo::Full)
+ if (update_algorithm_ == Model::UpdateAlgo::FULL)
update_actions_state_full(now, delta);
- else if (update_algorithm_ == Model::UpdateAlgo::Lazy)
+ else if (update_algorithm_ == Model::UpdateAlgo::LAZY)
update_actions_state_lazy(now, delta);
else
xbt_die("Invalid cpu update mechanism!");
*/
class XBT_PRIVATE HostModel : public kernel::resource::Model {
public:
- HostModel() : Model(Model::UpdateAlgo::Full) {}
+ HostModel() : Model(Model::UpdateAlgo::FULL) {}
virtual void ignore_empty_vm_in_pm_LMM();
virtual kernel::resource::Action* execute_parallel(int host_nb, sg_host_t* host_list, double* flops_amount,
* Model *
*********/
-StorageModel::StorageModel() : Model(Model::UpdateAlgo::Full)
+StorageModel::StorageModel() : Model(Model::UpdateAlgo::FULL)
{
set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */));
}
simgrid::kernel::resource::Model::UpdateAlgo algo;
if (cpu_optim_opt == "Lazy")
- algo = simgrid::kernel::resource::Model::UpdateAlgo::Lazy;
+ algo = simgrid::kernel::resource::Model::UpdateAlgo::LAZY;
else
- algo = simgrid::kernel::resource::Model::UpdateAlgo::Full;
+ algo = simgrid::kernel::resource::Model::UpdateAlgo::FULL;
surf_cpu_model_pm = new simgrid::surf::CpuCas01Model(algo);
all_existing_models->push_back(surf_cpu_model_pm);
{
bool select = simgrid::config::get_value<bool>("cpu/maxmin-selective-update");
- if (algo == Model::UpdateAlgo::Lazy) {
+ if (algo == Model::UpdateAlgo::LAZY) {
xbt_assert(select || simgrid::config::is_default("cpu/maxmin-selective-update"),
"You cannot disable cpu selective update when using the lazy update mechanism");
select = true;
action->set_state(simgrid::kernel::resource::Action::State::IGNORED);
get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
- if (get_model()->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy) { // remove action from the heap
+ if (get_model()->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::LAZY) { // remove action from the heap
get_model()->get_action_heap().remove(action);
// this is necessary for a variable with weight 0 since such variables are ignored in lmm and we need to set its
// max_duration correctly at the next call to share_resources
model->get_maxmin_system()->variable_new(this, 1.0 / requested_core, requested_core * speed, 1))
, requested_core_(requested_core)
{
- if (model->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy)
+ if (model->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::LAZY)
set_last_update();
model->get_maxmin_system()->expand(constraint, get_variable(), 1.0);
}
*********/
class CpuTiModel : public CpuModel {
public:
- CpuTiModel() : CpuModel(Model::UpdateAlgo::Full){};
+ CpuTiModel() : CpuModel(Model::UpdateAlgo::FULL){};
~CpuTiModel() override;
Cpu* create_cpu(simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core) override;
double next_occuring_event(double now) override;
namespace resource {
NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool))
- : NetworkModel(simgrid::config::get_value<std::string>("network/optim") == "Full" ? Model::UpdateAlgo::Full
- : Model::UpdateAlgo::Lazy)
+ : NetworkModel(simgrid::config::get_value<std::string>("network/optim") == "Full" ? Model::UpdateAlgo::FULL
+ : Model::UpdateAlgo::LAZY)
{
std::string optim = simgrid::config::get_value<std::string>("network/optim");
bool select = simgrid::config::get_value<bool>("network/maxmin-selective-update");
action->weight_ = latency;
action->latency_ = latency;
action->rate_ = rate;
- if (get_update_algorithm() == Model::UpdateAlgo::Lazy) {
+ if (get_update_algorithm() == Model::UpdateAlgo::LAZY) {
action->set_last_update();
}
if (action->latency_ > 0) {
action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable));
- if (get_update_algorithm() == Model::UpdateAlgo::Lazy) {
+ if (get_update_algorithm() == Model::UpdateAlgo::LAZY) {
// add to the heap the event when the latency is payed
double date = action->latency_ + action->get_last_update();
*********/
class NetworkConstantModel : public NetworkModel {
public:
- NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::Full) {}
+ NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::FULL) {}
Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size, double rate) override;
double next_occuring_event(double now) override;
void update_actions_state(double now, double delta) override;
namespace kernel {
namespace resource {
-NetworkNS3Model::NetworkNS3Model() : NetworkModel(Model::UpdateAlgo::Full)
+NetworkNS3Model::NetworkNS3Model() : NetworkModel(Model::UpdateAlgo::FULL)
{
xbt_assert(not sg_link_energy_is_inited(),
"LinkEnergy plugin and NS3 network models are not compatible. Are you looking for Ecofen, maybe?");
}
CpuL07Model::CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys)
- : CpuModel(Model::UpdateAlgo::Full), hostModel_(hmodel)
+ : CpuModel(Model::UpdateAlgo::FULL), hostModel_(hmodel)
{
set_maxmin_system(sys);
}
}
NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys)
- : NetworkModel(Model::UpdateAlgo::Full), hostModel_(hmodel)
+ : NetworkModel(Model::UpdateAlgo::FULL), hostModel_(hmodel)
{
set_maxmin_system(sys);
loopback_ = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE);