Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
enum class values should be UPPER_CASE
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 24 May 2018 23:59:06 +0000 (01:59 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 24 May 2018 23:59:06 +0000 (01:59 +0200)
include/simgrid/kernel/resource/Model.hpp
src/kernel/resource/Action.cpp
src/kernel/resource/Model.cpp
src/surf/HostImpl.hpp
src/surf/StorageImpl.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_ti.hpp
src/surf/network_cm02.cpp
src/surf/network_constant.hpp
src/surf/network_ns3.cpp
src/surf/ptask_L07.cpp

index 27cd604..59a0cce 100644 (file)
@@ -20,8 +20,8 @@ class XBT_PUBLIC Model {
 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.  */
index 02aee24..86f2e2a 100644 (file)
@@ -106,7 +106,7 @@ void Action::set_bound(double bound)
   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();
 }
@@ -124,7 +124,7 @@ void Action::ref()
 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);
 }
 
@@ -134,7 +134,7 @@ void Action::set_priority(double weight)
   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();
 }
@@ -142,7 +142,7 @@ void Action::set_priority(double weight)
 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);
@@ -164,7 +164,7 @@ void Action::suspend()
   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
@@ -182,7 +182,7 @@ void Action::resume()
   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();
@@ -197,7 +197,7 @@ double Action::get_remains()
 {
   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_;
index 63e662a..65c0350 100644 (file)
@@ -32,9 +32,9 @@ Action::ModifiedSet* Model::get_modified_set() const
 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!");
@@ -133,9 +133,9 @@ double Model::next_occuring_event_full(double /*now*/)
 
 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!");
index 4aa758f..a0a1892 100644 (file)
@@ -25,7 +25,7 @@ namespace surf {
  */
 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,
index 5df10ec..05dee15 100644 (file)
@@ -20,7 +20,7 @@ namespace surf {
  * Model *
  *********/
 
-StorageModel::StorageModel() : Model(Model::UpdateAlgo::Full)
+StorageModel::StorageModel() : Model(Model::UpdateAlgo::FULL)
 {
   set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */));
 }
index 1cf6f1b..c3bdc57 100644 (file)
@@ -44,9 +44,9 @@ void surf_cpu_model_init_Cas01()
 
   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);
@@ -62,7 +62,7 @@ CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid
 {
   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;
@@ -185,7 +185,7 @@ CpuAction *CpuCas01::sleep(double duration)
     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
@@ -205,7 +205,7 @@ CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool
                 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);
 }
index 5e961db..5751546 100644 (file)
@@ -139,7 +139,7 @@ typedef boost::intrusive::list<CpuTi, CpuTiListOptions> CpuTiList;
  *********/
 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;
index a0c0de0..dccd34a 100644 (file)
@@ -133,8 +133,8 @@ namespace kernel {
 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");
@@ -242,7 +242,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   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();
   }
 
@@ -267,7 +267,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
 
   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();
 
index d8e37a7..b3eb629 100644 (file)
@@ -26,7 +26,7 @@ class XBT_PRIVATE NetworkConstantAction;
  *********/
 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;
index f9d8731..0312d24 100644 (file)
@@ -150,7 +150,7 @@ namespace simgrid {
 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?");
index 9338334..8c6ec46 100644 (file)
@@ -43,7 +43,7 @@ HostL07Model::~HostL07Model()
 }
 
 CpuL07Model::CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys)
-    : CpuModel(Model::UpdateAlgo::Full), hostModel_(hmodel)
+    : CpuModel(Model::UpdateAlgo::FULL), hostModel_(hmodel)
 {
   set_maxmin_system(sys);
 }
@@ -54,7 +54,7 @@ CpuL07Model::~CpuL07Model()
 }
 
 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);