Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 27 Mar 2018 19:50:05 +0000 (21:50 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 27 Mar 2018 20:58:01 +0000 (22:58 +0200)
1  2 
include/simgrid/kernel/resource/Model.hpp
src/kernel/resource/Model.cpp
src/surf/cpu_cas01.cpp
src/surf/network_cm02.cpp

@@@ -90,11 -96,9 +93,9 @@@ public
     */
    virtual bool nextOccuringEventIsIdempotent() { return true; }
  
- protected:
-   lmm::System* maxmin_system_ = nullptr;
  private:
 -  e_UM_t update_mechanism_        = UM_UNDEFINED;
+   lmm::System* maxmin_system_           = nullptr;
 +  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 */
Simple merge
@@@ -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()
@@@ -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()