From: Martin Quinson Date: Tue, 27 Mar 2018 19:50:05 +0000 (+0200) Subject: Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid X-Git-Tag: v3.20~624 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/faedb72df7cffcf486677835fdd57d319a010bb1 Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid --- faedb72df7cffcf486677835fdd57d319a010bb1 diff --cc include/simgrid/kernel/resource/Model.hpp index 8e744df82c,5e8bbbf36e..1e1bebba44 --- a/include/simgrid/kernel/resource/Model.hpp +++ b/include/simgrid/kernel/resource/Model.hpp @@@ -90,11 -96,9 +93,9 @@@ public */ virtual bool nextOccuringEventIsIdempotent() { return true; } - protected: - lmm::System* maxmin_system_ = nullptr; - private: + lmm::System* maxmin_system_ = nullptr; - e_UM_t update_mechanism_ = UM_UNDEFINED; + UpdateAlgo update_mechanism_ = UpdateAlgo::UM_UNDEFINED; Action::StateSet* ready_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_READY */ Action::StateSet* running_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_RUNNING */ Action::StateSet* failed_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_FAILED */ diff --cc src/surf/cpu_cas01.cpp index 78c279d379,8fdf8d5220..a81898f9eb --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@@ -41,20 -41,20 +41,20 @@@ CpuCas01Model::CpuCas01Model() : simgri bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update"); if (optim == "Full") { - setUpdateMechanism(UM_FULL); + setUpdateMechanism(Model::UpdateAlgo::Full); } else if (optim == "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"); + setUpdateMechanism(Model::UpdateAlgo::Lazy); select = true; - xbt_assert(select || (xbt_cfg_is_default_value("cpu/maxmin-selective-update")), - "Disabling selective update while using the lazy update mechanism is dumb!"); - setUpdateMechanism(UM_LAZY); } else { xbt_die("Unsupported optimization (%s) for this model", optim.c_str()); } - maxmin_system_ = new simgrid::kernel::lmm::System(select); + set_maxmin_system(new simgrid::kernel::lmm::System(select)); - if (getUpdateMechanism() == UM_LAZY) + if (getUpdateMechanism() == Model::UpdateAlgo::Lazy) - maxmin_system_->modified_set_ = new kernel::resource::Action::ModifiedSet(); + get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet(); } CpuCas01Model::~CpuCas01Model() diff --cc src/surf/network_cm02.cpp index 521a1762a0,d81c45c87c..b4c77ac1ab --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@@ -141,26 -140,21 +140,21 @@@ NetworkCm02Model::NetworkCm02Model(kern bool select = xbt_cfg_get_boolean("network/maxmin-selective-update"); if (optim == "Full") { - setUpdateMechanism(UM_FULL); + setUpdateMechanism(kernel::resource::Model::UpdateAlgo::Full); } else if (optim == "Lazy") { + xbt_assert(select || xbt_cfg_is_default_value("network/maxmin-selective-update"), + "You cannot disable network selective update when using the lazy update mechanism"); select = true; - setUpdateMechanism(UM_LAZY); + setUpdateMechanism(kernel::resource::Model::UpdateAlgo::Lazy); - xbt_assert(select || (xbt_cfg_is_default_value("network/maxmin-selective-update")), - "You cannot disable selective update when using the lazy update mechanism"); } else { xbt_die("Unsupported optimization (%s) for this model. Accepted: Full, Lazy.", optim.c_str()); } - maxmin_system_ = new simgrid::kernel::lmm::System(select); + set_maxmin_system(make_new_lmm_system(select)); loopback_ = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE); - if (getUpdateMechanism() == UM_LAZY) + if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy) - maxmin_system_->modified_set_ = new kernel::resource::Action::ModifiedSet(); - } - - NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(kernel::lmm::System* self)) : NetworkCm02Model() - { - maxmin_system_->solve_fun = specificSolveFun; + get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet(); } LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency, @@@ -304,8 -298,8 +298,8 @@@ kernel::resource::Action* NetworkCm02Mo constraints_per_variable += back_route.size(); if (action->latency_ > 0) { - action->set_variable(maxmin_system_->variable_new(action, 0.0, -1.0, constraints_per_variable)); + action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable)); - if (getUpdateMechanism() == UM_LAZY) { + if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy) { // add to the heap the event when the latency is payed XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->get_last_update()); action->heapInsert(action->latency_ + action->get_last_update(), route.empty()