My goal here is to make updateAlgo a constant in each Model object.
+ Model(Model::UpdateAlgo algo);
+
virtual ~Model();
/** @brief Get the set of [actions](@ref Action) in *ready* state */
virtual ~Model();
/** @brief Get the set of [actions](@ref Action) in *ready* state */
/** @brief Set the maxmin system of the current Model */
void set_maxmin_system(lmm::System* system) { maxmin_system_ = system; }
/** @brief Set the maxmin system of the current Model */
void set_maxmin_system(lmm::System* system) { maxmin_system_ = system; }
- /**
- * @brief Get the update mechanism of the current Model
- * @see e_UM_t
- */
+ /** @brief Get the update mechanism of the current Model */
UpdateAlgo getUpdateMechanism() const { return update_mechanism_; }
void setUpdateMechanism(UpdateAlgo mechanism) { update_mechanism_ = mechanism; }
UpdateAlgo getUpdateMechanism() const { return update_mechanism_; }
void setUpdateMechanism(UpdateAlgo mechanism) { update_mechanism_ = mechanism; }
namespace resource {
Model::Model() = default;
namespace resource {
Model::Model() = default;
+Model::Model(Model::UpdateAlgo algo) : update_mechanism_(algo) {}
- surf_cpu_model_pm = new simgrid::surf::CpuCas01Model(cpu_optim_opt == "Lazy");
+ simgrid::kernel::resource::Model::UpdateAlgo algo;
+ if (cpu_optim_opt == "Lazy")
+ algo = simgrid::kernel::resource::Model::UpdateAlgo::Lazy;
+ else
+ 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);
all_existing_models->push_back(surf_cpu_model_pm);
- surf_cpu_model_vm = new simgrid::surf::CpuCas01Model(cpu_optim_opt == "Lazy");
+ surf_cpu_model_vm = new simgrid::surf::CpuCas01Model(algo);
all_existing_models->push_back(surf_cpu_model_vm);
}
namespace simgrid {
namespace surf {
all_existing_models->push_back(surf_cpu_model_vm);
}
namespace simgrid {
namespace surf {
-CpuCas01Model::CpuCas01Model(bool optim_lazy) : simgrid::surf::CpuModel()
+CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid::surf::CpuModel(algo)
{
bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");
{
bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");
+ if (algo == Model::UpdateAlgo::Lazy) {
xbt_assert(select || xbt_cfg_is_default_value("cpu/maxmin-selective-update"),
"You cannot disable cpu selective update when using the lazy update mechanism");
xbt_assert(select || xbt_cfg_is_default_value("cpu/maxmin-selective-update"),
"You cannot disable cpu selective update when using the lazy update mechanism");
- setUpdateMechanism(Model::UpdateAlgo::Lazy);
- } else {
- setUpdateMechanism(Model::UpdateAlgo::Full);
}
set_maxmin_system(new simgrid::kernel::lmm::System(select));
}
set_maxmin_system(new simgrid::kernel::lmm::System(select));
+ if (algo == Model::UpdateAlgo::Lazy)
get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
}
get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
}
class CpuCas01Model : public simgrid::surf::CpuModel {
public:
class CpuCas01Model : public simgrid::surf::CpuModel {
public:
- CpuCas01Model(bool optim_lazy);
+ CpuCas01Model(kernel::resource::Model::UpdateAlgo algo);
~CpuCas01Model() override;
Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
~CpuCas01Model() override;
Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
*/
class XBT_PUBLIC CpuModel : public kernel::resource::Model {
public:
*/
class XBT_PUBLIC CpuModel : public kernel::resource::Model {
public:
+ CpuModel(kernel::resource::Model::UpdateAlgo algo) : Model(algo) {}
+ CpuModel() : Model() {}
+
/**
* @brief Create a Cpu
*
/**
* @brief Create a Cpu
*
CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core)
: Cpu(model, host, speedPerPstate, core)
{
CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core)
: Cpu(model, host, speedPerPstate, core)
{
- xbt_assert(core==1,"Multi-core not handled by this model yet");
- coresAmount_ = core;
+ xbt_assert(core == 1, "Multi-core not handled by this model yet");
speed_.peak = speedPerPstate->front();
XBT_DEBUG("CPU create: peak=%f", speed_.peak);
speed_.peak = speedPerPstate->front();
XBT_DEBUG("CPU create: peak=%f", speed_.peak);