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>
Sat, 31 Mar 2018 17:27:07 +0000 (19:27 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 31 Mar 2018 17:27:07 +0000 (19:27 +0200)
49 files changed:
include/simgrid/kernel/resource/Model.hpp
include/simgrid/kernel/resource/Resource.hpp
include/simgrid/s4u/Host.hpp
include/xbt/config.hpp
src/kernel/lmm/fair_bottleneck.cpp
src/kernel/lmm/lagrange.cpp
src/kernel/lmm/maxmin.cpp
src/kernel/lmm/maxmin.hpp
src/kernel/resource/Action.cpp
src/kernel/resource/Model.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/plugins/vm/VirtualMachineImpl.hpp
src/s4u/s4u_host.cpp
src/s4u/s4u_link.cpp
src/simdag/sd_task.cpp
src/simgrid/host.cpp
src/simgrid/sg_config.cpp
src/simix/smx_host.cpp
src/smpi/colls/smpi_coll.cpp
src/smpi/include/SmpiHost.hpp
src/smpi/include/private.hpp
src/smpi/internals/SmpiHost.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_shared.cpp
src/smpi/mpi/smpi_request.cpp
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp
src/surf/StorageImpl.cpp
src/surf/StorageImpl.hpp
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/host_clm03.cpp
src/surf/network_cm02.cpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/surf_c_bindings.cpp
src/surf/trace_mgr_test.cpp
src/surf/xml/surfxml_parseplatf.cpp
teshsuite/surf/lmm_usage/lmm_usage.cpp
teshsuite/surf/maxmin_bench/maxmin_bench.cpp
teshsuite/surf/maxmin_bench/maxmin_bench_medium.tesh
teshsuite/surf/maxmin_bench/maxmin_bench_small.tesh

index 7703923..b803d87 100644 (file)
@@ -29,6 +29,8 @@ public:
   };
 
   Model();
+  Model(Model::UpdateAlgo algo);
+
   virtual ~Model();
 
   /** @brief Get the set of [actions](@ref Action) in *ready* state */
@@ -52,10 +54,7 @@ public:
   /** @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; }
 
index 551ff4c..7c8c075 100644 (file)
@@ -53,7 +53,7 @@ public:
   virtual void apply_event(TraceEvent* event, double value) = 0;
 
   /** @brief Check if the current Resource is used (if it currently serves an action) */
-  virtual bool isUsed() = 0;
+  virtual bool is_used() = 0;
 
   /** @brief returns the current load (in flops per second, byte per second or similar) */
   virtual double getLoad();
index c5d4e09..a87405b 100644 (file)
@@ -95,7 +95,9 @@ public:
   int getPstatesCount() const;
   void setPstate(int pstate_index);
   int getPstate();
-  void getAttachedStorages(std::vector<const char*> * storages);
+  std::vector<const char*> get_attached_storages();
+  XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_attached_storages() instead.") void getAttachedStorages(
+      std::vector<const char*>* storages);
 
   /** Get an associative list [mount point]->[Storage] of all local mount points.
    *
index 1ce01c3..f773739 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <functional>
 #include <initializer_list>
+#include <map>
 #include <stdexcept>
 #include <string>
 #include <type_traits>
@@ -19,6 +20,7 @@
 
 #include <xbt/base.h>
 #include <xbt/config.h>
+#include <xbt/sysdep.h>
 
 namespace simgrid {
 namespace config {
@@ -152,12 +154,37 @@ bindFlag(T& value, const char* name, const char* description,
     }
   ));
 }
-
+template <class T, class F>
+typename std::enable_if<std::is_same<void, decltype(std::declval<F>()(std::declval<const T&>()))>::value, void>::type
+bindFlag(T& value, const char* name, const char* description, std::map<T, std::string> valid_values, F callback)
+{
+  declareFlag(name, description, value,
+              std::function<void(const T&)>([&value, name, valid_values, callback](const T& val) {
+                callback(val);
+                bool found = false;
+                for (auto kv : valid_values) {
+                  if (kv.first == val)
+                    found = true;
+                }
+                if (not found || std::string(val) == "help") {
+                  std::string mesg;
+                  if (std::string(val) == "help")
+                    mesg = std::string("\nPossible values for option ") + name + ":\n";
+                  else
+                    mesg = std::string("\nInvalid value '") + val + "' for option " + name + ". Possible values:\n";
+                  for (auto kv : valid_values)
+                    mesg += "  - '" + std::string(kv.first) + "': " + kv.second +
+                            (kv.first == value ? "  <=== DEFAULT" : "") + "\n";
+                  xbt_die("%s", mesg.c_str());
+                }
+                value = std::move(val);
+              }));
+}
 /** Bind a variable to configuration flag
  *
  *  <pre><code>
  *  static int x;
- *  simgrid::config::bindFlag(a, "x", [](int x) { return return x > 0; });
+ *  simgrid::config::bindFlag(a, "x", [](int x) { return x > 0; });
  *  </code></pre>
  */
 // F is a predicate, F : T const& -> bool
@@ -172,7 +199,7 @@ bindFlag(T& value, const char* name, const char* description,
   declareFlag(name, description, value,
     std::function<void(const T&)>([&value, callback](const T& val) {
       if (not callback(val))
-        throw std::range_error("invalid value");
+        throw std::range_error("invalid value.");
         value = std::move(val);
     })
   );
@@ -182,7 +209,7 @@ bindFlag(T& value, const char* name, const char* description,
  *
  *  <pre><code>
  *  static simgrid::config::flag<int> answer("answer", "Expected answer", 42);
- *  static simgrid::config::flag<std::string> name("name", "Ford Prefect", "John Doe");
+ *  static simgrid::config::flag<std::string> name("name", "Ford Perfect", "John Doe");
  *  static simgrid::config::flag<double> gamma("gamma", "Gamma factor", 1.987);
  *  </code></pre>
  */
@@ -202,12 +229,24 @@ public:
     simgrid::config::bindFlag(value_, name, desc);
   }
 
+  /* A constructor accepting a callback that will be passed the parameter.
+   * It can either return a boolean (informing whether the parameter is valid), or returning void.
+   */
   template<class F>
   Flag(const char* name, const char* desc, T value, F callback) : value_(value)
   {
     simgrid::config::bindFlag(value_, name, desc, std::move(callback));
   }
 
+  /* A constructor accepting a map of valid values -> their description,
+   * and producing an informative error message when an invalid value is passed, or when help is passed as a value.
+   */
+  template <class F>
+  Flag(const char* name, const char* desc, T value, std::map<T, std::string> valid_values, F callback) : value_(value)
+  {
+    simgrid::config::bindFlag(value_, name, desc, std::move(valid_values), std::move(callback));
+  }
+
   // No copy:
   Flag(Flag const&) = delete;
   Flag& operator=(Flag const&) = delete;
index 94cb183..bb1bd48 100644 (file)
@@ -21,7 +21,7 @@ simgrid::kernel::lmm::System* simgrid::kernel::lmm::make_new_fair_bottleneck_sys
 
 void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
 {
-  if (not modified)
+  if (not modified_)
     return;
 
   XBT_DEBUG("Variable set : %zu", variable_set.size());
@@ -144,7 +144,7 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
   } while (not var_list.empty());
 
   cnst_list.clear();
-  modified = true;
+  modified_ = true;
   if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
     XBT_DEBUG("Fair bottleneck done");
     print();
index f8afafd..8d6cb06 100644 (file)
@@ -142,7 +142,7 @@ void Lagrange::lagrange_solve()
     print();
   }
 
-  if (not modified)
+  if (not modified_)
     return;
 
   /* Initialize lambda. */
index 0b27a67..002b9c0 100644 (file)
@@ -117,7 +117,7 @@ void System::check_concurrency() const
 void System::var_free(Variable* var)
 {
   XBT_IN("(sys=%p, var=%p)", this, var);
-  modified = true;
+  modified_ = true;
 
   // TODOLATER Can do better than that by leaving only the variable in only one enabled_element_set, call
   // update_modified_set, and then remove it..
@@ -144,19 +144,16 @@ void System::var_free(Variable* var)
 
   check_concurrency();
 
-  xbt_mallocator_release(variable_mallocator, var);
+  xbt_mallocator_release(variable_mallocator_, var);
   XBT_OUT();
 }
 
 System::System(bool selective_update) : selective_update_active(selective_update)
 {
-  modified        = false;
-  visited_counter = 1;
-
   XBT_DEBUG("Setting selective_update_active flag to %d", selective_update_active);
 
-  variable_mallocator =
-      xbt_mallocator_new(65536, System::variable_mallocator_new_f, System::variable_mallocator_free_f, nullptr);
+  if (selective_update)
+    modified_set_ = new kernel::resource::Action::ModifiedSet();
 }
 
 System::~System()
@@ -173,7 +170,7 @@ System::~System()
   while ((cnst = extract_constraint()))
     cnst_free(cnst);
 
-  xbt_mallocator_free(variable_mallocator);
+  xbt_mallocator_free(variable_mallocator_);
   delete modified_set_;
 }
 
@@ -221,8 +218,8 @@ Variable* System::variable_new(simgrid::kernel::resource::Action* id, double sha
 {
   XBT_IN("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)", this, id, sharing_weight, bound, number_of_constraints);
 
-  Variable* var = static_cast<Variable*>(xbt_mallocator_get(variable_mallocator));
-  var->initialize(id, sharing_weight, bound, number_of_constraints, visited_counter - 1);
+  Variable* var = static_cast<Variable*>(xbt_mallocator_get(variable_mallocator_));
+  var->initialize(id, sharing_weight, bound, number_of_constraints, visited_counter_ - 1);
   if (sharing_weight)
     variable_set.push_front(*var);
   else
@@ -240,7 +237,7 @@ void System::variable_free(Variable* var)
 
 void System::expand(Constraint* cnst, Variable* var, double consumption_weight)
 {
-  modified = true;
+  modified_ = true;
 
   // Check if this variable already has an active element in this constraint
   // If it does, substract it from the required slack
@@ -293,7 +290,7 @@ void System::expand(Constraint* cnst, Variable* var, double consumption_weight)
 
 void System::expand_add(Constraint* cnst, Variable* var, double value)
 {
-  modified = true;
+  modified_ = true;
 
   check_concurrency();
 
@@ -492,7 +489,7 @@ void System::print() const
 
 void System::lmm_solve()
 {
-  if (modified) {
+  if (modified_) {
     XBT_IN("(sys=%p)", this);
     /* Compute Usage and store the variables that reach the maximum. If selective_update_active is true, only
      * constraints that changed are considered. Otherwise all constraints with active actions are considered.
@@ -681,7 +678,7 @@ template <class CnstList> void System::lmm_solve(CnstList& cnst_list)
 
   } while (cnst_light_num > 0);
 
-  modified = false;
+  modified_ = false;
   if (selective_update_active)
     remove_all_modified_set();
 
@@ -704,7 +701,7 @@ template <class CnstList> void System::lmm_solve(CnstList& cnst_list)
  */
 void System::update_variable_bound(Variable* var, double bound)
 {
-  modified   = true;
+  modified_  = true;
   var->bound = bound;
 
   if (not var->cnsts.empty())
@@ -860,7 +857,7 @@ void System::update_variable_weight(Variable* var, double weight)
 
   XBT_IN("(sys=%p, var=%p, weight=%f)", this, var, weight);
 
-  modified = true;
+  modified_ = true;
 
   // Are we enabling this variable?
   if (enabling_var) {
@@ -888,7 +885,7 @@ void System::update_variable_weight(Variable* var, double weight)
 
 void System::update_constraint_bound(Constraint* cnst, double bound)
 {
-  modified = true;
+  modified_ = true;
   update_modified_set(cnst);
   cnst->bound = bound;
 }
@@ -906,7 +903,7 @@ void System::update_modified_set_rec(Constraint* cnst)
   for (Element const& elem : cnst->enabled_element_set) {
     Variable* var = elem.variable;
     for (Element const& elem2 : var->cnsts) {
-      if (var->visited == visited_counter)
+      if (var->visited == visited_counter_)
         break;
       if (elem2.constraint != cnst && not elem2.constraint->modified_constraint_set_hook.is_linked()) {
         modified_constraint_set.push_back(*elem2.constraint);
@@ -914,7 +911,7 @@ void System::update_modified_set_rec(Constraint* cnst)
       }
     }
     // var will be ignored in later visits as long as sys->visited_counter does not move
-    var->visited = visited_counter;
+    var->visited = visited_counter_;
   }
 }
 
@@ -934,7 +931,7 @@ void System::remove_all_modified_set()
   // To be clean, when visited counter has wrapped around, we force these var->visited values so that variables that
   // were in the modified a long long time ago are not wrongly skipped here, which would lead to very nasty bugs
   // (i.e. not readibily reproducible, and requiring a lot of run time before happening).
-  if (++visited_counter == 1) {
+  if (++visited_counter_ == 1) {
     /* the counter wrapped around, reset each variable->visited */
     for (Variable& var : variable_set)
       var.visited = 0;
index 8c006f5..c67f8c4 100644 (file)
@@ -575,7 +575,7 @@ private:
   template <class CnstList> void lmm_solve(CnstList& cnst_list);
 
 public:
-  bool modified;
+  bool modified_ = false;
   boost::intrusive::list<Variable, boost::intrusive::member_hook<Variable, boost::intrusive::list_member_hook<>,
                                                                  &Variable::variable_set_hook>>
       variable_set;
@@ -593,15 +593,17 @@ public:
 
 private:
   bool selective_update_active; /* flag to update partially the system only selecting changed portions */
-  unsigned visited_counter;     /* used by System::update_modified_set() and System::remove_all_modified_set() to
-                                 * cleverly (un-)flag the constraints (more details in these functions) */
+  unsigned visited_counter_ = 1; /* used by System::update_modified_set() and System::remove_all_modified_set() to
+                                  * cleverly (un-)flag the constraints (more details in these functions) */
   boost::intrusive::list<Constraint, boost::intrusive::member_hook<Constraint, boost::intrusive::list_member_hook<>,
                                                                    &Constraint::constraint_set_hook>>
       constraint_set;
   boost::intrusive::list<Constraint, boost::intrusive::member_hook<Constraint, boost::intrusive::list_member_hook<>,
                                                                    &Constraint::modified_constraint_set_hook>>
       modified_constraint_set;
-  xbt_mallocator_t variable_mallocator;
+  xbt_mallocator_t variable_mallocator_ =
+      xbt_mallocator_new(65536, System::variable_mallocator_new_f, System::variable_mallocator_free_f, nullptr);
+  ;
 };
 
 class XBT_PUBLIC FairBottleneck : public System {
index 9e64d25..44f57ce 100644 (file)
@@ -36,12 +36,11 @@ Action::~Action()
     simgrid::xbt::intrusive_erase(*state_set_, *this);
   if (get_variable())
     get_model()->get_maxmin_system()->variable_free(get_variable());
-  if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy) {
-    /* remove from heap */
-    heapRemove();
-    if (modified_set_hook_.is_linked())
-      simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this);
-  }
+
+  /* remove from heap on need (ie, if selective update) */
+  heapRemove();
+  if (modified_set_hook_.is_linked())
+    simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this);
 
   xbt_free(category_);
 }
index 5e73044..e463d99 100644 (file)
@@ -13,6 +13,7 @@ namespace kernel {
 namespace resource {
 
 Model::Model() = default;
+Model::Model(Model::UpdateAlgo algo) : update_mechanism_(algo) {}
 
 Model::~Model()
 {
index 6eeac3d..15277a4 100644 (file)
@@ -103,7 +103,7 @@ double VMModel::next_occuring_event(double now)
   }
 
   /* 2. Calculate resource share at the virtual machine layer. */
-  ignoreEmptyVmInPmLMM();
+  ignore_empty_vm_in_pm_LMM();
 
   /* 3. Ready. Get the next occurring event */
   return surf_cpu_model_vm->next_occuring_event(now);
index 575103b..362409a 100644 (file)
@@ -98,7 +98,7 @@ private:
 class XBT_PRIVATE VMModel : public surf::HostModel {
 public:
   VMModel();
-  void ignoreEmptyVmInPmLMM() override{};
+  void ignore_empty_vm_in_pm_LMM() override{};
 
   double next_occuring_event(double now) override;
   void update_actions_state(double /*now*/, double /*delta*/) override{};
index 38b14b2..61c8305 100644 (file)
@@ -235,11 +235,17 @@ int Host::getPstate()
  * \brief Returns the list of storages attached to an host.
  * \return a vector containing all storages attached to the host
  */
+std::vector<const char*> Host::get_attached_storages()
+{
+  return simgrid::simix::kernelImmediate([this] { return this->pimpl_->get_attached_storages(); });
+}
+
 void Host::getAttachedStorages(std::vector<const char*>* storages)
 {
-  simgrid::simix::kernelImmediate([this, storages] {
-     this->pimpl_->getAttachedStorageList(storages);
-  });
+  std::vector<const char*> local_storages =
+      simgrid::simix::kernelImmediate([this] { return this->pimpl_->get_attached_storages(); });
+  for (auto elm : local_storages)
+    storages->push_back(elm);
 }
 
 std::unordered_map<std::string, Storage*> const& Host::getMountedStorages()
index 02e0102..b366521 100644 (file)
@@ -94,7 +94,7 @@ const char* Link::name()
 }
 bool Link::isUsed()
 {
-  return this->pimpl_->isUsed();
+  return this->pimpl_->is_used();
 }
 
 double Link::latency()
index a6c81da..2cf77b6 100644 (file)
@@ -808,7 +808,7 @@ void SD_task_run(SD_task_t task)
   if(task->bytes_amount)
     std::copy_n(task->bytes_amount, host_nb * host_nb, bytes_amount);
 
-  task->surf_action = surf_host_model->executeParallelTask(host_nb, hosts, flops_amount, bytes_amount, task->rate);
+  task->surf_action = surf_host_model->execute_parallel(host_nb, hosts, flops_amount, bytes_amount, task->rate);
 
   task->surf_action->set_data(task);
 
index 346a1c4..e47f72a 100644 (file)
@@ -110,12 +110,10 @@ xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){
 }
 
 xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){
-  std::vector<const char*>* storage_vector = new std::vector<const char*>();
   xbt_dynar_t storage_dynar = xbt_dynar_new(sizeof(const char*), nullptr);
-  host->getAttachedStorages(storage_vector);
-  for (auto const& name : *storage_vector)
+  std::vector<const char*> storage_vector = host->get_attached_storages();
+  for (auto const& name : storage_vector)
     xbt_dynar_push(storage_dynar, &name);
-  delete storage_vector;
   return storage_dynar;
 }
 
@@ -151,7 +149,7 @@ int sg_host_core_count(sg_host_t host)
 
 double sg_host_get_available_speed(sg_host_t host)
 {
-  return host->pimpl_cpu->getAvailableSpeed();
+  return host->pimpl_cpu->get_available_speed();
 }
 
 /** @brief Returns the number of power states for a host.
index 6c6dfec..3fe0c43 100644 (file)
@@ -301,10 +301,6 @@ void sg_config_init(int *argc, char **argv)
   describe_model(description, descsize, surf_cpu_model_description, "model", "The model to use for the CPU");
   xbt_cfg_register_string("cpu/model", "Cas01", &_sg_cfg_cb__cpu_model, description);
 
-  describe_model(description, descsize, surf_optimization_mode_description, "optimization mode",
-                 "The optimization modes to use for the CPU");
-  xbt_cfg_register_string("cpu/optim", "Lazy", &_sg_cfg_cb__optimization_mode, description);
-
   describe_model(description, descsize, surf_storage_model_description, "model", "The model to use for the storage");
   xbt_cfg_register_string("storage/model", "default", &_sg_cfg_cb__storage_mode, description);
 
index b6f81fd..c85a416 100644 (file)
@@ -181,7 +181,7 @@ SIMIX_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_li
     /* set surf's synchro */
     sg_host_t* host_list_cpy = new sg_host_t[host_nb];
     std::copy_n(host_list, host_nb, host_list_cpy);
-    exec->surfAction_ = surf_host_model->executeParallelTask(host_nb, host_list_cpy, flops_amount, bytes_amount, rate);
+    exec->surfAction_ = surf_host_model->execute_parallel(host_nb, host_list_cpy, flops_amount, bytes_amount, rate);
     exec->surfAction_->set_data(exec.get());
     if (timeout > 0) {
       exec->timeoutDetector = host_list[0]->pimpl_cpu->sleep(timeout);
index 3606038..59425a3 100644 (file)
@@ -1,6 +1,6 @@
 /* smpi_coll.c -- various optimized routing for collectives                 */
 
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -11,6 +11,7 @@
 #include "smpi_datatype.hpp"
 #include "smpi_op.hpp"
 #include "smpi_request.hpp"
+#include "xbt/config.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll)");
 
index 024bb92..2a88bba 100644 (file)
@@ -12,7 +12,6 @@
 #include <string>
 #include <vector>
 #include <xbt/Extendable.hpp>
-#include <xbt/config.hpp>
 
 namespace simgrid {
 namespace smpi {
index b5edb7a..5bb015b 100644 (file)
@@ -6,7 +6,6 @@
 #ifndef SMPI_PRIVATE_HPP
 #define SMPI_PRIVATE_HPP
 
-#include "include/xbt/config.hpp"
 #include "simgrid/msg.h" // msg_bar_t
 #include "smpi/smpi.h"
 #include "src/instr/instr_smpi.hpp"
index 827eb76..0160728 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -6,6 +6,7 @@
 #include "SmpiHost.hpp"
 #include "simgrid/s4u/VirtualMachine.hpp"
 #include "smpi_utils.hpp"
+#include "xbt/config.hpp"
 
 #include <string>
 #include <vector>
index 54736a6..423fe6e 100644 (file)
@@ -11,6 +11,8 @@
 #include "src/internal_config.h"
 #include "src/mc/mc_replay.hpp"
 #include "src/simix/ActorImpl.hpp"
+#include "xbt/config.hpp"
+
 #include <unordered_map>
 
 #ifndef WIN32
index b4f18eb..44f6ebb 100644 (file)
@@ -37,6 +37,8 @@
 #include <cstring>
 
 #include "private.hpp"
+#include "xbt/config.hpp"
+
 #include <cerrno>
 
 #include <sys/types.h>
index b2e9be6..c0bd4f6 100644 (file)
@@ -15,6 +15,7 @@
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/mc/mc_replay.hpp"
 #include "src/simix/ActorImpl.hpp"
+#include "xbt/config.hpp"
 
 #include <algorithm>
 
index 889b934..2005f1c 100644 (file)
@@ -24,7 +24,7 @@ namespace surf {
 /* Each VM has a dummy CPU action on the PM layer. This CPU action works as the constraint (capacity) of the VM in the
  * PM layer. If the VM does not have any active task, the dummy CPU action must be deactivated, so that the VM does not
  * get any CPU share in the PM layer. */
-void HostModel::ignoreEmptyVmInPmLMM()
+void HostModel::ignore_empty_vm_in_pm_LMM()
 {
   /* iterate for all virtual machines */
   for (s4u::VirtualMachine* const& ws_vm : vm::VirtualMachineImpl::allVms_) {
@@ -51,8 +51,8 @@ static inline double has_cost(double* array, int pos)
     return -1.0;
 }
 
-kernel::resource::Action* HostModel::executeParallelTask(int host_nb, s4u::Host** host_list, double* flops_amount,
-                                                         double* bytes_amount, double rate)
+kernel::resource::Action* HostModel::execute_parallel(int host_nb, s4u::Host** host_list, double* flops_amount,
+                                                      double* bytes_amount, double rate)
 {
   kernel::resource::Action* action = nullptr;
   if ((host_nb == 1) && (has_cost(bytes_amount, 0) <= 0)) {
@@ -101,11 +101,13 @@ HostImpl::HostImpl(s4u::Host* host) : piface_(host)
   piface_->pimpl_ = this;
 }
 
-void HostImpl::getAttachedStorageList(std::vector<const char*>* storages)
+std::vector<const char*> HostImpl::get_attached_storages()
 {
+  std::vector<const char*> storages;
   for (auto const& s : storage_)
     if (s.second->getHost() == piface_->getCname())
-      storages->push_back(s.second->piface_.getCname());
+      storages.push_back(s.second->piface_.getCname());
+  return storages;
 }
 
 }
index 3325fd3..85db47a 100644 (file)
@@ -35,9 +35,9 @@ class XBT_PRIVATE HostModel : public kernel::resource::Model {
 public:
   HostModel() : Model() {}
 
-  virtual void ignoreEmptyVmInPmLMM();
-  virtual kernel::resource::Action* executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount,
-                                                        double* bytes_amount, double rate);
+  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,
+                                                     double* bytes_amount, double rate);
 };
 
 /************
@@ -54,7 +54,7 @@ public:
   virtual ~HostImpl() = default;
 
   /** @brief Get the vector of storages (by names) attached to the Host */
-  virtual void getAttachedStorageList(std::vector<const char*>* storages);
+  virtual std::vector<const char*> get_attached_storages();
 
   std::map<std::string, simgrid::surf::StorageImpl*> storage_;
   simgrid::s4u::Host* piface_ = nullptr;
index d15f285..4d4d01a 100644 (file)
@@ -65,7 +65,7 @@ StorageImpl::~StorageImpl()
   storageDestructedCallbacks(this);
 }
 
-bool StorageImpl::isUsed()
+bool StorageImpl::is_used()
 {
   THROW_UNIMPLEMENTED;
   return false;
index 9b3610f..f0c29a6 100644 (file)
@@ -94,7 +94,7 @@ public:
   s4u::Storage piface_;
 
   /** @brief Check if the Storage is used (if an action currently uses its resources) */
-  bool isUsed() override;
+  bool is_used() override;
 
   void apply_event(tmgr_trace_event_t event, double value) override;
 
@@ -152,7 +152,7 @@ public:
    * @brief StorageAction constructor
    *
    * @param model The StorageModel associated to this StorageAction
-   * @param cost The cost of this  NetworkAction in [TODO]
+   * @param cost The cost of this StorageAction in bytes
    * @param failed [description]
    * @param storage The Storage associated to this StorageAction
    * @param type [description]
index 808b78a..4f105a5 100644 (file)
@@ -7,10 +7,31 @@
 #include "cpu_ti.hpp"
 #include "simgrid/sg_config.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
+#include "xbt/config.hpp"
 #include "xbt/utility.hpp"
+
 #include <algorithm>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_cas, surf_cpu, "Logging specific to the SURF CPU IMPROVED module");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_cas, surf_cpu, "Logging specific to the SURF CPU module");
+
+/***********
+ * Options *
+ ***********/
+
+static simgrid::config::Flag<std::string>
+    cpu_optim_opt("cpu/optim", "Optimization algorithm to use for CPU resources. ", "Lazy",
+
+                  std::map<std::string, std::string>({
+                      {"Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining)."},
+                      {"TI", "Trace integration. Highly optimized mode when using availability traces (only available "
+                             "for the Cas01 CPU model for now)."},
+                      {"Full", "Full update of remaining and variables. Slow but may be useful when debugging."},
+                  }),
+
+                  [](std::string const& val) {
+                    xbt_assert(_sg_cfg_init_status < 2,
+                               "Cannot change the optimization algorithm after the initialization");
+                  });
 
 /*********
  * Model *
@@ -20,41 +41,38 @@ void surf_cpu_model_init_Cas01()
   xbt_assert(not surf_cpu_model_pm);
   xbt_assert(not surf_cpu_model_vm);
 
-  if (xbt_cfg_get_string("cpu/optim") == "TI") {
+  if (cpu_optim_opt == "TI") {
     surf_cpu_model_init_ti();
     return;
   }
 
-  surf_cpu_model_pm = new simgrid::surf::CpuCas01Model();
+  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);
 
-  surf_cpu_model_vm  = new simgrid::surf::CpuCas01Model();
+  surf_cpu_model_vm = new simgrid::surf::CpuCas01Model(algo);
   all_existing_models->push_back(surf_cpu_model_vm);
 }
 
 namespace simgrid {
 namespace surf {
 
-CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel()
+CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid::surf::CpuModel(algo)
 {
-  std::string optim = xbt_cfg_get_string("cpu/optim");
   bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");
 
-  if (optim == "Full") {
-    setUpdateMechanism(Model::UpdateAlgo::Full);
-  } else if (optim == "Lazy") {
+  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");
-    setUpdateMechanism(Model::UpdateAlgo::Lazy);
     select = true;
-  } else {
-    xbt_die("Unsupported optimization (%s) for this model", optim.c_str());
   }
 
   set_maxmin_system(new simgrid::kernel::lmm::System(select));
-
-  if (getUpdateMechanism() == Model::UpdateAlgo::Lazy)
-    get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
 }
 
 CpuCas01Model::~CpuCas01Model()
@@ -86,7 +104,7 @@ std::vector<double> * CpuCas01::getSpeedPeakList(){
   return &speedPerPstate_;
 }
 
-bool CpuCas01::isUsed()
+bool CpuCas01::is_used()
 {
   return model()->get_maxmin_system()->constraint_used(constraint());
 }
index 7ed577b..3671bd8 100644 (file)
@@ -24,7 +24,7 @@ class XBT_PRIVATE CpuCas01Action;
 
 class CpuCas01Model : public simgrid::surf::CpuModel {
 public:
-  CpuCas01Model();
+  CpuCas01Model(kernel::resource::Model::UpdateAlgo algo);
   ~CpuCas01Model() override;
 
   Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
@@ -44,7 +44,7 @@ public:
   CpuAction* execution_start(double size, int requestedCore) override;
   CpuAction* sleep(double duration) override;
 
-  bool isUsed() override;
+  bool is_used() override;
 
   std::vector<double> * getSpeedPeakList(); // FIXME: killme to hide our internals
 
index bbac0ef..9747338 100644 (file)
@@ -136,7 +136,7 @@ double Cpu::getSpeed(double load)
   return load * speed_.peak;
 }
 
-double Cpu::getAvailableSpeed()
+double Cpu::get_available_speed()
 {
 /* number between 0 and 1 */
   return speed_.scale;
@@ -158,7 +158,7 @@ void Cpu::setStateTrace(tmgr_trace_t trace)
 
   stateEvent_ = future_evt_set->add_trace(trace, this);
 }
-void Cpu::setSpeedTrace(tmgr_trace_t trace)
+void Cpu::set_speed_trace(tmgr_trace_t trace)
 {
   xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->getCname());
 
index 375c1d7..00d095c 100644 (file)
@@ -26,6 +26,9 @@ namespace surf {
  */
 class XBT_PUBLIC CpuModel : public kernel::resource::Model {
 public:
+  CpuModel(kernel::resource::Model::UpdateAlgo algo) : Model(algo) {}
+  CpuModel() : Model() {}
+
   /**
    * @brief Create a Cpu
    *
@@ -111,7 +114,7 @@ protected:
 
 public:
   /** @brief Get the available speed of the current Cpu */
-  virtual double getAvailableSpeed();
+  virtual double get_available_speed();
 
   /** @brief Get the current Cpu computational speed */
   virtual double getPstateSpeed(int pstate_index);
@@ -129,7 +132,9 @@ public:
   int pstate_ = 0;                     /*< Current pstate (index in the speedPeakList)*/
 
   virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values (0 or 1). */
-  virtual void setSpeedTrace(tmgr_trace_t trace); /*< setup the trace file with availability events (peak speed changes due to external load). Trace must contain relative values (ratio between 0 and 1) */
+  virtual void
+  set_speed_trace(tmgr_trace_t trace); /*< setup the trace file with availability events (peak speed changes due to
+                                          external load). Trace must contain relative values (ratio between 0 and 1) */
 
   tmgr_trace_event_t stateEvent_ = nullptr;
   Metric speed_                  = {1.0, 0, nullptr};
index 4fc9b6c..06a7f58 100644 (file)
@@ -25,23 +25,23 @@ CpuTiTrace::CpuTiTrace(tmgr_trace_t speedTrace)
   double integral = 0;
   double time = 0;
   int i = 0;
-  nbPoints_ = speedTrace->event_list.size() + 1;
-  timePoints_ = new double[nbPoints_];
-  integral_ =  new double[nbPoints_];
+  nb_points_      = speedTrace->event_list.size() + 1;
+  time_points_    = new double[nb_points_];
+  integral_       = new double[nb_points_];
   for (auto const& val : speedTrace->event_list) {
-    timePoints_[i] = time;
+    time_points_[i] = time;
     integral_[i] = integral;
     integral += val.date_ * val.value_;
     time += val.date_;
     i++;
   }
-  timePoints_[i] = time;
+  time_points_[i] = time;
   integral_[i] = integral;
 }
 
 CpuTiTrace::~CpuTiTrace()
 {
-  delete [] timePoints_;
+  delete[] time_points_;
   delete [] integral_;
 }
 
@@ -76,20 +76,20 @@ double CpuTiTgmr::integrate(double a, double b)
     return ((b - a) * value_);
   }
 
-  if (fabs(ceil(a / lastTime_) - a / lastTime_) < EPSILON)
-    a_index = 1 + static_cast<int>(ceil(a / lastTime_));
+  if (fabs(ceil(a / last_time_) - a / last_time_) < EPSILON)
+    a_index = 1 + static_cast<int>(ceil(a / last_time_));
   else
-    a_index = static_cast<int> (ceil(a / lastTime_));
+    a_index = static_cast<int>(ceil(a / last_time_));
 
-  int b_index = static_cast<int> (floor(b / lastTime_));
+  int b_index = static_cast<int>(floor(b / last_time_));
 
   if (a_index > b_index) {      /* Same chunk */
-    return trace_->integrateSimple(a - (a_index - 1) * lastTime_, b - (b_index) * lastTime_);
+    return trace_->integrate_simple(a - (a_index - 1) * last_time_, b - (b_index)*last_time_);
   }
 
-  double first_chunk = trace_->integrateSimple(a - (a_index - 1) * lastTime_, lastTime_);
+  double first_chunk  = trace_->integrate_simple(a - (a_index - 1) * last_time_, last_time_);
   double middle_chunk = (b_index - a_index) * total_;
-  double last_chunk = trace_->integrateSimple(0.0, b - (b_index) * lastTime_);
+  double last_chunk   = trace_->integrate_simple(0.0, b - (b_index)*last_time_);
 
   XBT_DEBUG("first_chunk=%.2f  middle_chunk=%.2f  last_chunk=%.2f\n", first_chunk, middle_chunk, last_chunk);
 
@@ -102,28 +102,28 @@ double CpuTiTgmr::integrate(double a, double b)
  * \param a  Initial point
  * \param b  Final point
 */
-double CpuTiTrace::integrateSimple(double a, double b)
+double CpuTiTrace::integrate_simple(double a, double b)
 {
-  return integrateSimplePoint(b) - integrateSimplePoint(a);
+  return integrate_simple_point(b) - integrate_simple_point(a);
 }
 
 /**
  * \brief Auxiliary function to compute the integral at point a.
  * \param a        point
  */
-double CpuTiTrace::integrateSimplePoint(double a)
+double CpuTiTrace::integrate_simple_point(double a)
 {
   double integral = 0;
   double a_aux = a;
-  int ind = binarySearch(timePoints_, a, 0, nbPoints_ - 1);
+  int ind         = binary_search(time_points_, a, 0, nb_points_ - 1);
   integral += integral_[ind];
 
-  XBT_DEBUG("a %f ind %d integral %f ind + 1 %f ind %f time +1 %f time %f",
-       a, ind, integral, integral_[ind + 1], integral_[ind], timePoints_[ind + 1], timePoints_[ind]);
-  double_update(&a_aux, timePoints_[ind], sg_maxmin_precision*sg_surf_precision);
+  XBT_DEBUG("a %f ind %d integral %f ind + 1 %f ind %f time +1 %f time %f", a, ind, integral, integral_[ind + 1],
+            integral_[ind], time_points_[ind + 1], time_points_[ind]);
+  double_update(&a_aux, time_points_[ind], sg_maxmin_precision * sg_surf_precision);
   if (a_aux > 0)
-    integral += ((integral_[ind + 1] - integral_[ind]) / (timePoints_[ind + 1] - timePoints_[ind])) *
-                (a - timePoints_[ind]);
+    integral +=
+        ((integral_[ind + 1] - integral_[ind]) / (time_points_[ind + 1] - time_points_[ind])) * (a - time_points_[ind]);
   XBT_DEBUG("Integral a %f = %f", a, integral);
 
   return integral;
@@ -168,38 +168,23 @@ double CpuTiTgmr::solve(double a, double amount)
   /* Reduce the problem to one where amount <= trace_total */
   int quotient = static_cast<int>(floor(amount / total_));
   double reduced_amount = (total_) * ((amount / total_) - floor(amount / total_));
-  double reduced_a = a - (lastTime_) * static_cast<int>(floor(a / lastTime_));
+  double reduced_a      = a - (last_time_) * static_cast<int>(floor(a / last_time_));
 
   XBT_DEBUG("Quotient: %d reduced_amount: %f reduced_a: %f", quotient, reduced_amount, reduced_a);
 
   /* Now solve for new_amount which is <= trace_total */
-  double reduced_b = solveSomewhatSimple(reduced_a, reduced_amount);
+  double reduced_b;
+  XBT_DEBUG("Solve integral: [%.2f, amount=%.2f]", reduced_a, reduced_amount);
+  double amount_till_end = integrate(reduced_a, last_time_);
 
-/* Re-map to the original b and amount */
-  double b = (lastTime_) * static_cast<int>(floor(a / lastTime_)) + (quotient * lastTime_) + reduced_b;
-  return b;
-}
-
-/**
-* \brief Auxiliary function to solve integral
-*
-* Here, amount is <= trace->total
-* and a <=trace->last_time
-*
-*/
-double CpuTiTgmr::solveSomewhatSimple(double a, double amount)
-{
-  double b;
-
-  XBT_DEBUG("Solve integral: [%.2f, amount=%.2f]", a, amount);
-  double amount_till_end = integrate(a, lastTime_);
-
-  if (amount_till_end > amount) {
-    b = trace_->solveSimple(a, amount);
+  if (amount_till_end > reduced_amount) {
+    reduced_b = trace_->solve_simple(reduced_a, reduced_amount);
   } else {
-    b = lastTime_ + trace_->solveSimple(0.0, amount - amount_till_end);
+    reduced_b = last_time_ + trace_->solve_simple(0.0, reduced_amount - amount_till_end);
   }
-  return b;
+
+  /* Re-map to the original b and amount */
+  return (last_time_) * static_cast<int>(floor(a / last_time_)) + (quotient * last_time_) + reduced_b;
 }
 
 /**
@@ -209,13 +194,13 @@ double CpuTiTgmr::solveSomewhatSimple(double a, double amount)
  * \param amount  Amount of flops
  * \return The date when amount is available.
 */
-double CpuTiTrace::solveSimple(double a, double amount)
+double CpuTiTrace::solve_simple(double a, double amount)
 {
-  double integral_a = integrateSimplePoint(a);
-  int ind = binarySearch(integral_, integral_a + amount, 0, nbPoints_ - 1);
-  double time = timePoints_[ind];
+  double integral_a = integrate_simple_point(a);
+  int ind           = binary_search(integral_, integral_a + amount, 0, nb_points_ - 1);
+  double time       = time_points_[ind];
   time += (integral_a + amount - integral_[ind]) /
-           ((integral_[ind + 1] - integral_[ind]) / (timePoints_[ind + 1] - timePoints_[ind]));
+          ((integral_[ind + 1] - integral_[ind]) / (time_points_[ind + 1] - time_points_[ind]));
 
   return time;
 }
@@ -227,11 +212,11 @@ double CpuTiTrace::solveSimple(double a, double amount)
 * \param a        Time
 * \return CPU speed scale
 */
-double CpuTiTgmr::getPowerScale(double a)
+double CpuTiTgmr::get_power_scale(double a)
 {
-  double reduced_a = a - floor(a / lastTime_) * lastTime_;
-  int point = trace_->binarySearch(trace_->timePoints_, reduced_a, 0, trace_->nbPoints_ - 1);
-  trace_mgr::DatedValue val = speedTrace_->event_list.at(point);
+  double reduced_a          = a - floor(a / last_time_) * last_time_;
+  int point                 = trace_->binary_search(trace_->time_points_, reduced_a, 0, trace_->nb_points_ - 1);
+  trace_mgr::DatedValue val = speed_trace_->event_list.at(point);
   return val.value_;
 }
 
@@ -242,8 +227,7 @@ double CpuTiTgmr::getPowerScale(double a)
 * \param  value          Percentage of CPU speed available (useful to fixed tracing)
 * \return  Integration trace structure
 */
-CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) :
-    speedTrace_(speedTrace)
+CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) : speed_trace_(speedTrace)
 {
   double total_time = 0.0;
   trace_ = 0;
@@ -271,10 +255,10 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) :
     total_time += val.date_;
 
   trace_ = new CpuTiTrace(speedTrace);
-  lastTime_ = total_time;
-  total_ = trace_->integrateSimple(0, total_time);
+  last_time_ = total_time;
+  total_    = trace_->integrate_simple(0, total_time);
 
-  XBT_DEBUG("Total integral %f, last_time %f ", total_, lastTime_);
+  XBT_DEBUG("Total integral %f, last_time %f ", total_, last_time_);
 }
 
 /**
@@ -286,7 +270,7 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) :
  * \param high    Upper bound to search in array
  * \return Index of point
 */
-int CpuTiTrace::binarySearch(double *array, double a, int low, int high)
+int CpuTiTrace::binary_search(double* array, double a, int low, int high)
 {
   xbt_assert(low < high, "Wrong parameters: low (%d) should be smaller than high (%d)", low, high);
 
@@ -341,10 +325,10 @@ double CpuTiModel::next_occuring_event(double now)
   double min_action_duration = -1;
 
   /* iterates over modified cpus to update share resources */
-  for (auto it = std::begin(modifiedCpu_); it != std::end(modifiedCpu_);) {
+  for (auto it = std::begin(modified_cpus_); it != std::end(modified_cpus_);) {
     CpuTi& ti = *it;
     ++it; // increment iterator here since the following call to ti.updateActionsFinishTime() may invalidate it
-    ti.updateActionsFinishTime(now);
+    ti.update_actions_finish_time(now);
   }
 
   /* get the min next event if heap not empty */
@@ -363,7 +347,7 @@ void CpuTiModel::update_actions_state(double now, double /*delta*/)
     XBT_DEBUG("Action %p: finish", action);
     action->finish(kernel::resource::Action::State::done);
     /* update remaining amount of all actions */
-    action->cpu_->updateRemainingAmount(surf_get_clock());
+    action->cpu_->update_remaining_amount(surf_get_clock());
   }
 }
 
@@ -373,26 +357,25 @@ void CpuTiModel::update_actions_state(double now, double /*delta*/)
 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);
 
-  speedIntegratedTrace_ = new CpuTiTgmr(nullptr, 1/*scale*/);
+  speed_integrated_trace_ = new CpuTiTgmr(nullptr, 1 /*scale*/);
 }
 
 CpuTi::~CpuTi()
 {
-  modified(false);
-  delete speedIntegratedTrace_;
+  set_modified(false);
+  delete speed_integrated_trace_;
 }
-void CpuTi::setSpeedTrace(tmgr_trace_t trace)
+void CpuTi::set_speed_trace(tmgr_trace_t trace)
 {
-  if (speedIntegratedTrace_)
-    delete speedIntegratedTrace_;
+  if (speed_integrated_trace_)
+    delete speed_integrated_trace_;
 
-  speedIntegratedTrace_ = new CpuTiTgmr(trace, speed_.scale);
+  speed_integrated_trace_ = new CpuTiTgmr(trace, speed_.scale);
 
   /* add a fake trace event if periodicity == 0 */
   if (trace && trace->event_list.size() > 1) {
@@ -410,19 +393,19 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value)
 
     XBT_DEBUG("Finish trace date: value %f", value);
     /* update remaining of actions and put in modified cpu list */
-    updateRemainingAmount(surf_get_clock());
+    update_remaining_amount(surf_get_clock());
 
-    modified(true);
+    set_modified(true);
 
-    speedTrace = speedIntegratedTrace_->speedTrace_;
+    speedTrace                = speed_integrated_trace_->speed_trace_;
     trace_mgr::DatedValue val = speedTrace->event_list.back();
-    delete speedIntegratedTrace_;
+    delete speed_integrated_trace_;
     speed_.scale = val.value_;
 
     trace = new CpuTiTgmr(TRACE_FIXED, val.value_);
     XBT_DEBUG("value %f", val.value_);
 
-    speedIntegratedTrace_ = trace;
+    speed_integrated_trace_ = trace;
 
     tmgr_trace_event_unref(&speed_.event);
 
@@ -436,7 +419,7 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value)
       double date = surf_get_clock();
 
       /* put all action running on cpu to failed */
-      for (CpuTiAction& action : actionSet_) {
+      for (CpuTiAction& action : action_set_) {
         if (action.get_state() == kernel::resource::Action::State::running ||
             action.get_state() == kernel::resource::Action::State::ready ||
             action.get_state() == kernel::resource::Action::State::not_in_the_system) {
@@ -453,15 +436,15 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value)
   }
 }
 
-void CpuTi::updateActionsFinishTime(double now)
+/** Update the actions that are running on this CPU (which was modified recently) */
+void CpuTi::update_actions_finish_time(double now)
 {
-  double sum_priority = 0.0;
-  double total_area;
-
   /* update remaining amount of actions */
-  updateRemainingAmount(now);
+  update_remaining_amount(now);
 
-  for (CpuTiAction const& action : actionSet_) {
+  /* Compute the sum of priorities for the actions running on that CPU */
+  sum_priority_ = 0.0;
+  for (CpuTiAction const& action : action_set_) {
     /* action not running, skip it */
     if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
       continue;
@@ -474,11 +457,10 @@ void CpuTi::updateActionsFinishTime(double now)
     if (action.suspended_ != kernel::resource::Action::SuspendStates::not_suspended)
       continue;
 
-    sum_priority += 1.0 / action.get_priority();
+    sum_priority_ += 1.0 / action.get_priority();
   }
-  sumPriority_ = sum_priority;
 
-  for (CpuTiAction& action : actionSet_) {
+  for (CpuTiAction& action : action_set_) {
     double min_finish = -1;
     /* action not running, skip it */
     if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
@@ -487,11 +469,9 @@ void CpuTi::updateActionsFinishTime(double now)
     /* verify if the action is really running on cpu */
     if (action.suspended_ == kernel::resource::Action::SuspendStates::not_suspended && action.get_priority() > 0) {
       /* total area needed to finish the action. Used in trace integration */
-      total_area = (action.get_remains()) * sum_priority * action.get_priority();
-
-      total_area /= speed_.peak;
+      double total_area = (action.get_remains() * sum_priority_ * action.get_priority()) / speed_.peak;
 
-      action.set_finish_time(speedIntegratedTrace_->solve(now, total_area));
+      action.set_finish_time(speed_integrated_trace_->solve(now, total_area));
       /* verify which event will happen before (max_duration or finish time) */
       if (action.get_max_duration() > NO_MAX_DURATION &&
           action.get_start_time() + action.get_max_duration() < action.get_finish_time())
@@ -513,32 +493,32 @@ void CpuTi::updateActionsFinishTime(double now)
               &action, action.get_start_time(), action.get_finish_time(), action.get_max_duration());
   }
   /* remove from modified cpu */
-  modified(false);
+  set_modified(false);
 }
 
-bool CpuTi::isUsed()
+bool CpuTi::is_used()
 {
-  return not actionSet_.empty();
+  return not action_set_.empty();
 }
 
-double CpuTi::getAvailableSpeed()
+double CpuTi::get_available_speed()
 {
-  speed_.scale = speedIntegratedTrace_->getPowerScale(surf_get_clock());
-  return Cpu::getAvailableSpeed();
+  speed_.scale = speed_integrated_trace_->get_power_scale(surf_get_clock());
+  return Cpu::get_available_speed();
 }
 
 /** @brief Update the remaining amount of actions */
-void CpuTi::updateRemainingAmount(double now)
+void CpuTi::update_remaining_amount(double now)
 {
 
   /* already updated */
-  if (lastUpdate_ >= now)
+  if (last_update_ >= now)
     return;
 
   /* compute the integration area */
-  double area_total = speedIntegratedTrace_->integrate(lastUpdate_, now) * speed_.peak;
-  XBT_DEBUG("Flops total: %f, Last update %f", area_total, lastUpdate_);
-  for (CpuTiAction& action : actionSet_) {
+  double area_total = speed_integrated_trace_->integrate(last_update_, now) * speed_.peak;
+  XBT_DEBUG("Flops total: %f, Last update %f", area_total, last_update_);
+  for (CpuTiAction& action : action_set_) {
     /* action not running, skip it */
     if (action.get_state_set() != model()->get_running_action_set())
       continue;
@@ -560,10 +540,10 @@ void CpuTi::updateRemainingAmount(double now)
       continue;
 
     /* update remaining */
-    action.update_remains(area_total / (sumPriority_ * action.get_priority()));
+    action.update_remains(area_total / (sum_priority_ * action.get_priority()));
     XBT_DEBUG("Update remaining action(%p) remaining %f", &action, action.get_remains_no_update());
   }
-  lastUpdate_ = now;
+  last_update_ = now;
 }
 
 CpuAction *CpuTi::execution_start(double size)
@@ -571,7 +551,7 @@ CpuAction *CpuTi::execution_start(double size)
   XBT_IN("(%s,%g)", getCname(), size);
   CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), size, isOff(), this);
 
-  actionSet_.push_back(*action);
+  action_set_.push_back(*action);
 
   XBT_OUT();
   return action;
@@ -595,14 +575,15 @@ CpuAction *CpuTi::sleep(double duration)
     action->get_state_set()->push_back(*action);
   }
 
-  actionSet_.push_back(*action);
+  action_set_.push_back(*action);
 
   XBT_OUT();
   return action;
 }
 
-void CpuTi::modified(bool modified){
-  CpuTiList& modifiedCpu = static_cast<CpuTiModel*>(model())->modifiedCpu_;
+void CpuTi::set_modified(bool modified)
+{
+  CpuTiList& modifiedCpu = static_cast<CpuTiModel*>(model())->modified_cpus_;
   if (modified) {
     if (not cpu_ti_hook.is_linked()) {
       modifiedCpu.push_back(*this);
@@ -621,29 +602,29 @@ CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed, CpuTi *cp
  : CpuAction(model_, cost, failed)
  , cpu_(cpu)
 {
-  cpu_->modified(true);
+  cpu_->set_modified(true);
 }
 CpuTiAction::~CpuTiAction()
 {
   /* remove from action_set */
   if (action_ti_hook.is_linked())
-    simgrid::xbt::intrusive_erase(cpu_->actionSet_, *this);
+    simgrid::xbt::intrusive_erase(cpu_->action_set_, *this);
   /* remove from heap */
   heapRemove();
-  cpu_->modified(true);
+  cpu_->set_modified(true);
 }
 
 void CpuTiAction::set_state(Action::State state)
 {
   CpuAction::set_state(state);
-  cpu_->modified(true);
+  cpu_->set_modified(true);
 }
 
 void CpuTiAction::cancel()
 {
   this->set_state(Action::State::failed);
   heapRemove();
-  cpu_->modified(true);
+  cpu_->set_modified(true);
 }
 
 void CpuTiAction::suspend()
@@ -652,7 +633,7 @@ void CpuTiAction::suspend()
   if (suspended_ != Action::SuspendStates::sleeping) {
     suspended_ = Action::SuspendStates::suspended;
     heapRemove();
-    cpu_->modified(true);
+    cpu_->set_modified(true);
   }
   XBT_OUT();
 }
@@ -662,7 +643,7 @@ void CpuTiAction::resume()
   XBT_IN("(%p)", this);
   if (suspended_ != Action::SuspendStates::sleeping) {
     suspended_ = Action::SuspendStates::not_suspended;
-    cpu_->modified(true);
+    cpu_->set_modified(true);
   }
   XBT_OUT();
 }
@@ -691,14 +672,14 @@ void CpuTiAction::set_priority(double priority)
 {
   XBT_IN("(%p,%g)", this, priority);
   set_priority_no_update(priority);
-  cpu_->modified(true);
+  cpu_->set_modified(true);
   XBT_OUT();
 }
 
 double CpuTiAction::get_remains()
 {
   XBT_IN("(%p)", this);
-  cpu_->updateRemainingAmount(surf_get_clock());
+  cpu_->update_remaining_amount(surf_get_clock());
   XBT_OUT();
   return get_remains_no_update();
 }
index ec9d0a0..982727d 100644 (file)
@@ -19,13 +19,8 @@ namespace surf {
 /***********
  * Classes *
  ***********/
-class XBT_PRIVATE CpuTiTrace;
-class XBT_PRIVATE CpuTiTgmr;
 class XBT_PRIVATE CpuTiModel;
 class XBT_PRIVATE CpuTi;
-class XBT_PRIVATE CpuTiAction;
-
-struct tiTag;
 
 /*********
  * Trace *
@@ -35,14 +30,14 @@ public:
   explicit CpuTiTrace(tmgr_trace_t speedTrace);
   ~CpuTiTrace();
 
-  double integrateSimple(double a, double b);
-  double integrateSimplePoint(double a);
-  double solveSimple(double a, double amount);
+  double integrate_simple(double a, double b);
+  double integrate_simple_point(double a);
+  double solve_simple(double a, double amount);
 
-  double *timePoints_;
+  double* time_points_;
   double *integral_;
-  int nbPoints_;
-  int binarySearch(double *array, double a, int low, int high);
+  int nb_points_;
+  int binary_search(double* array, double a, int low, int high);
 };
 
 enum trace_type {
@@ -61,18 +56,17 @@ public:
 
   double integrate(double a, double b);
   double solve(double a, double amount);
-  double solveSomewhatSimple(double a, double amount);
-  double getPowerScale(double a);
+  double get_power_scale(double a);
 
   trace_type type_;
   double value_;                 /*< Percentage of cpu speed available. Value fixed between 0 and 1 */
 
   /* Dynamic */
-  double lastTime_ = 0.0;             /*< Integral interval last point (discrete time) */
+  double last_time_ = 0.0;             /*< Integral interval last point (discrete time) */
   double total_    = 0.0;             /*< Integral total between 0 and last_pointn */
 
   CpuTiTrace *trace_ = nullptr;
-  tmgr_trace_t speedTrace_ = nullptr;
+  tmgr_trace_t speed_trace_ = nullptr;
 };
 
 /**********
@@ -106,16 +100,16 @@ typedef boost::intrusive::list<CpuTiAction, ActionTiListOptions > ActionTiList;
  ************/
 class CpuTi : public Cpu {
 public:
-  CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core);
+  CpuTi(CpuTiModel* model, simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core);
   ~CpuTi() override;
 
-  void setSpeedTrace(tmgr_trace_t trace) override;
+  void set_speed_trace(tmgr_trace_t trace) override;
 
   void apply_event(tmgr_trace_event_t event, double value) override;
-  void updateActionsFinishTime(double now);
-  void updateRemainingAmount(double now);
+  void update_actions_finish_time(double now);
+  void update_remaining_amount(double now);
 
-  bool isUsed() override;
+  bool is_used() override;
   CpuAction *execution_start(double size) override;
   simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) override
   {
@@ -123,16 +117,16 @@ public:
     return nullptr;
   }
   CpuAction *sleep(double duration) override;
-  double getAvailableSpeed() override;
+  double get_available_speed() override;
 
-  void modified(bool modified);
+  void set_modified(bool modified);
 
-  CpuTiTgmr *speedIntegratedTrace_ = nullptr;/*< Structure with data needed to integrate trace file */
-  ActionTiList actionSet_;                   /*< set with all actions running on cpu */
-  double sumPriority_ = 0; /*< the sum of actions' priority that are running on cpu */
-  double lastUpdate_ = 0;  /*< last update of actions' remaining amount done */
+  CpuTiTgmr* speed_integrated_trace_ = nullptr; /*< Structure with data needed to integrate trace file */
+  ActionTiList action_set_;                     /*< set with all actions running on cpu */
+  double sum_priority_ = 0;                  /*< the sum of actions' priority that are running on cpu */
+  double last_update_  = 0;                  /*< last update of actions' remaining amount done */
 
-  double currentFrequency_;
+  double current_frequency_;
 
   boost::intrusive::list_member_hook<> cpu_ti_hook;
 };
@@ -147,12 +141,12 @@ class CpuTiModel : public CpuModel {
 public:
   CpuTiModel() = default;
   ~CpuTiModel() override;
-  Cpu *createCpu(simgrid::s4u::Host *host,  std::vector<double>* speedPerPstate, int core) override;
+  Cpu* createCpu(simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core) override;
   double next_occuring_event(double now) override;
   void update_actions_state(double now, double delta) override;
 
   kernel::resource::Action::StateSet runningActionSetThatDoesNotNeedBeingChecked_;
-  CpuTiList modifiedCpu_;
+  CpuTiList modified_cpus_;
 };
 
 }
index 3cbf508..3bf1082 100644 (file)
@@ -47,7 +47,7 @@ namespace surf {
 
 double HostCLM03Model::next_occuring_event(double now)
 {
-  ignoreEmptyVmInPmLMM();
+  ignore_empty_vm_in_pm_LMM();
 
   double min_by_cpu = surf_cpu_model_pm->next_occuring_event(now);
   double min_by_net =
index f300d63..41a9f4b 100644 (file)
@@ -152,9 +152,6 @@ NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(b
 
   set_maxmin_system(make_new_lmm_system(select));
   loopback_     = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
-
-  if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy)
-    get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
 }
 
 LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
index 950e535..b7efd16 100644 (file)
@@ -131,7 +131,7 @@ namespace simgrid {
       }
     }
 
-    bool LinkImpl::isUsed()
+    bool LinkImpl::is_used()
     {
       return model()->get_maxmin_system()->constraint_used(constraint());
     }
index 2565a14..c26d753 100644 (file)
@@ -141,7 +141,7 @@ public:
   virtual int sharingPolicy();
 
   /** @brief Check if the Link is used */
-  bool isUsed() override;
+  bool is_used() override;
 
   void turnOn() override;
   void turnOff() override;
index 94a69e3..2a348a9 100644 (file)
@@ -134,8 +134,8 @@ void HostL07Model::update_actions_state(double /*now*/, double delta)
   }
 }
 
-kernel::resource::Action* HostL07Model::executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount,
-                                                            double* bytes_amount, double rate)
+kernel::resource::Action* HostL07Model::execute_parallel(int host_nb, sg_host_t* host_list, double* flops_amount,
+                                                         double* bytes_amount, double rate)
 {
   return new L07Action(this, host_nb, host_list, flops_amount, bytes_amount, rate);
 }
@@ -221,7 +221,7 @@ kernel::resource::Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host
   host_list[1]    = dst;
   bytes_amount[1] = size;
 
-  return hostModel_->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate);
+  return hostModel_->execute_parallel(2, host_list, flops_amount, bytes_amount, rate);
 }
 
 Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host,  std::vector<double> *speedPerPstate, int core)
@@ -267,7 +267,7 @@ kernel::resource::Action* CpuL07::execution_start(double size)
   host_list[0] = getHost();
   flops_amount[0] = size;
 
-  return static_cast<CpuL07Model*>(model())->hostModel_->executeParallelTask(1, host_list, flops_amount, nullptr, -1);
+  return static_cast<CpuL07Model*>(model())->hostModel_->execute_parallel(1, host_list, flops_amount, nullptr, -1);
 }
 
 kernel::resource::Action* CpuL07::sleep(double duration)
@@ -280,7 +280,8 @@ kernel::resource::Action* CpuL07::sleep(double duration)
   return action;
 }
 
-bool CpuL07::isUsed(){
+bool CpuL07::is_used()
+{
   return model()->get_maxmin_system()->constraint_used(constraint());
 }
 
@@ -299,8 +300,8 @@ void CpuL07::onSpeedChange() {
   Cpu::onSpeedChange();
 }
 
-
-bool LinkL07::isUsed(){
+bool LinkL07::is_used()
+{
   return model()->get_maxmin_system()->constraint_used(constraint());
 }
 
index 40f54e6..25364a2 100644 (file)
@@ -40,8 +40,8 @@ public:
 
   double next_occuring_event(double now) override;
   void update_actions_state(double now, double delta) override;
-  kernel::resource::Action* executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount,
-                                                double* bytes_amount, double rate) override;
+  kernel::resource::Action* execute_parallel(int host_nb, sg_host_t* host_list, double* flops_amount,
+                                             double* bytes_amount, double rate) override;
 };
 
 class CpuL07Model : public CpuModel {
@@ -73,7 +73,7 @@ class CpuL07 : public Cpu {
 public:
   CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, std::vector<double> * speedPerPstate, int core);
   ~CpuL07() override;
-  bool isUsed() override;
+  bool is_used() override;
   void apply_event(tmgr_trace_event_t event, double value) override;
   kernel::resource::Action* execution_start(double size) override;
   simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) override
@@ -92,7 +92,7 @@ public:
   LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
           e_surf_link_sharing_policy_t policy);
   ~LinkL07() override;
-  bool isUsed() override;
+  bool is_used() override;
   void apply_event(tmgr_trace_event_t event, double value) override;
   void setBandwidth(double value) override;
   void setLatency(double value) override;
@@ -104,8 +104,9 @@ public:
 class L07Action : public CpuAction {
   friend Action *CpuL07::execution_start(double size);
   friend Action *CpuL07::sleep(double duration);
-  friend Action *HostL07Model::executeParallelTask(int host_nb, sg_host_t*host_list,
-                                                   double *flops_amount, double *bytes_amount, double rate);
+  friend Action* HostL07Model::execute_parallel(int host_nb, sg_host_t* host_list, double* flops_amount,
+                                                double* bytes_amount, double rate);
+
 public:
   L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* host_list, double* flops_amount,
             double* bytes_amount, double rate);
index 6718257..dc6fee2 100644 (file)
@@ -83,7 +83,7 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
   if (args->state_trace)
     host->pimpl_cpu->setStateTrace(args->state_trace);
   if (args->speed_trace)
-    host->pimpl_cpu->setSpeedTrace(args->speed_trace);
+    host->pimpl_cpu->set_speed_trace(args->speed_trace);
   if (args->pstate != 0)
     host->pimpl_cpu->setPState(args->pstate);
   if (args->coord && strcmp(args->coord, ""))
@@ -490,7 +490,7 @@ void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer)
   if (peer->state_trace)
     host->pimpl_cpu->setStateTrace(peer->state_trace);
   if (peer->speed_trace)
-    host->pimpl_cpu->setSpeedTrace(peer->speed_trace);
+    host->pimpl_cpu->set_speed_trace(peer->speed_trace);
 }
 
 void sg_platf_begin() { /* Do nothing: just for symmetry of user code */ }
index 968e024..e96c017 100644 (file)
@@ -108,7 +108,7 @@ double surf_solve(double max_date)
     XBT_DEBUG("Updating models (min = %g, NOW = %g, next_event_date = %g)", time_delta, NOW, next_event_date);
 
     while ((event = future_evt_set->pop_leq(next_event_date, &value, &resource))) {
-      if (resource->isUsed() || (watched_hosts.find(resource->getCname()) != watched_hosts.end())) {
+      if (resource->is_used() || (watched_hosts.find(resource->getCname()) != watched_hosts.end())) {
         time_delta = next_event_date - NOW;
         XBT_DEBUG("This event invalidates the next_occuring_event() computation of models. Next event set to %f", time_delta);
       }
index fc8601a..decf142 100644 (file)
@@ -27,12 +27,12 @@ double thedate;
 class MockedResource : public simgrid::kernel::resource::Resource {
 public:
   explicit MockedResource() : simgrid::kernel::resource::Resource(nullptr, "fake", nullptr) {}
-  void apply_event(tmgr_trace_event_t event, double value)
+  void apply_event(tmgr_trace_event_t event, double value) override
   {
     XBT_VERB("t=%.1f: Change value to %lg (idx: %u)", thedate, value, event->idx);
     tmgr_trace_event_unref(&event);
   }
-  bool isUsed() { return true; }
+  bool is_used() override { return true; }
 };
 
 static void trace2vector(const char* str, std::vector<tmgr::DatedValue>* whereto)
index d287f06..3066653 100644 (file)
@@ -133,7 +133,7 @@ void parse_platform_file(const char *file)
     xbt_assert(host, "Host %s undefined", elm.second.c_str());
     simgrid::surf::Cpu* cpu = host->pimpl_cpu;
 
-    cpu->setSpeedTrace(trace);
+    cpu->set_speed_trace(trace);
   }
 
   for (auto const& elm : trace_connect_list_link_avail) {
index 6bfc152..8b2d01c 100644 (file)
@@ -27,14 +27,15 @@ using namespace simgrid::kernel;
 
 enum method_t { MAXMIN, LAGRANGE_RENO, LAGRANGE_VEGAS };
 
-static lmm::System* new_system(method_t method, bool update)
+static lmm::System* new_system(method_t method)
 {
+  /* selective update would need real actions instead of NULL as a first parameter to the variable constructor */
   switch (method) {
     case MAXMIN:
-      return lmm::make_new_maxmin_system(update);
+      return lmm::make_new_maxmin_system(false);
     case LAGRANGE_VEGAS:
     case LAGRANGE_RENO:
-      return lmm::make_new_lagrange_system(update);
+      return lmm::make_new_lagrange_system(false);
     default:
       xbt_die("Invalid method");
   }
@@ -108,7 +109,7 @@ static void test1(method_t method)
   else if (method == LAGRANGE_RENO)
     lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
 
-  lmm::System* Sys    = new_system(method, true);
+  lmm::System* Sys    = new_system(method);
   lmm::Constraint* L1 = Sys->constraint_new(nullptr, a);
   lmm::Constraint* L2 = Sys->constraint_new(nullptr, b);
   lmm::Constraint* L3 = Sys->constraint_new(nullptr, a);
@@ -194,7 +195,7 @@ static void test2(method_t method)
   if (method == LAGRANGE_RENO)
     lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
 
-  lmm::System* Sys = new_system(method, true);
+  lmm::System* Sys = new_system(method);
 
   lmm::Constraint* CPU1 = Sys->constraint_new(nullptr, 200.0);
   lmm::Constraint* CPU2 = Sys->constraint_new(nullptr, 100.0);
@@ -260,7 +261,7 @@ static void test3(method_t method)
   if (method == LAGRANGE_RENO)
     lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
 
-  lmm::System* Sys = new_system(method, true);
+  lmm::System* Sys = new_system(method);
 
   /* Creates the constraints */
   lmm::Constraint** tmp_cnst = new lmm::Constraint*[15];
index c23689e..5175990 100644 (file)
@@ -44,7 +44,8 @@ static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limi
   lmm::Variable* var[nb_var];
   int used[nb_cnst];
 
-  lmm::System* Sys = new lmm::System(true);
+  /* We cannot activate the selective update as we pass nullptr as an Action when creating the variables */
+  lmm::System* Sys = new lmm::System(false);
 
   for (int i = 0; i < nb_cnst; i++) {
     cnst[i] = Sys->constraint_new(NULL, float_random(10.0));
index 74c6140..25c131e 100644 (file)
@@ -4,7 +4,7 @@
 ! expect return 0
 ! output sort
 $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench medium 5 test
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 100
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '98' usage: 13.060939 remaining: 3.166833 concurrency: 7<=8<=10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '80' usage: 12.338661 remaining: 3.766234 concurrency: 7<=8<=16
@@ -573,7 +573,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench medium 5 test
 > [0.000000]: [surf_maxmin/DEBUG] '97'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '98'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '99'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 100
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '111' usage: 16.414585 remaining: 0.229770 concurrency: 9<=9<=9
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '112' usage: 12.855644 remaining: 0.239760 concurrency: 7<=8<=40
@@ -1134,7 +1134,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench medium 5 test
 > [0.000000]: [surf_maxmin/DEBUG] '198'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '199'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '200'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 100
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '285' usage: 14.339161 remaining: 6.593407 concurrency: 7<=8<=24
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '249' usage: 17.094905 remaining: 3.656344 concurrency: 9<=9<=9
@@ -1715,7 +1715,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench medium 5 test
 > [0.000000]: [surf_maxmin/DEBUG] '298'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '299'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '300'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 100
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '325' usage: 22.924076 remaining: 9.700300 concurrency: 11<=12<=40
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '400' usage: 10.918082 remaining: 9.520480 concurrency: 7<=7<=16
@@ -2304,7 +2304,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench medium 5 test
 > [0.000000]: [surf_maxmin/DEBUG] '398'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '399'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '400'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 100
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '500' usage: 16.228771 remaining: 6.223776 concurrency: 7<=8<=24
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '464' usage: 13.778721 remaining: 2.417582 concurrency: 9<=9<=9
index 30ccb15..40449aa 100644 (file)
@@ -4,7 +4,7 @@
 ! expect return 0
 ! output sort
 $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '9' usage: 4.703796 remaining: 7.082917 concurrency: 2<=2<=-1
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '6' usage: 5.688312 remaining: 9.860140 concurrency: 3<=3<=3
@@ -73,7 +73,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '6'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '7'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '8'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '16' usage: 2.596903 remaining: 9.730270 concurrency: 2<=2<=3
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '20' usage: 6.927572 remaining: 1.978022 concurrency: 4<=4<=4
@@ -150,7 +150,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '11'(1.000000) : 0.316463
 > [0.000000]: [surf_maxmin/DEBUG] '16'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '20'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '28' usage: 2.611888 remaining: 2.127872 concurrency: 1<=1<=3
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '26' usage: 3.101898 remaining: 6.863137 concurrency: 2<=2<=-1
@@ -219,7 +219,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '27'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '29'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '30'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '31' usage: 1.213786 remaining: 9.950050 concurrency: 1<=1<=4
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '35' usage: 6.809191 remaining: 3.656344 concurrency: 4<=4<=-1
@@ -295,7 +295,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '31'(1.000000) : 0.757364
 > [0.000000]: [surf_maxmin/DEBUG] '34'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '37'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '42' usage: 10.002498 remaining: 3.556444 concurrency: 4<=4<=4
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '49' usage: 2.623876 remaining: 2.117882 concurrency: 1<=2<=3
@@ -368,7 +368,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '45'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '48'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '49'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '54' usage: 5.379620 remaining: 3.456543 concurrency: 3<=3<=-1
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '53' usage: 4.633367 remaining: 6.793207 concurrency: 3<=3<=3
@@ -445,7 +445,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '51'(1.000000) : 1.219766
 > [0.000000]: [surf_maxmin/DEBUG] '55'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '60'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '66' usage: 8.571429 remaining: 7.002997 concurrency: 4<=4<=-1
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '65' usage: 4.924076 remaining: 2.937063 concurrency: 2<=3<=4
@@ -513,7 +513,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '68'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '69'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '70'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '73' usage: 5.087413 remaining: 7.882118 concurrency: 2<=2<=-1
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '72' usage: 4.393606 remaining: 8.511489 concurrency: 2<=2<=3
@@ -590,7 +590,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '71'(1.000000) : 0.854701
 > [0.000000]: [surf_maxmin/DEBUG] '78'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '79'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '86' usage: 5.734765 remaining: 0.609391 concurrency: 4<=4<=4
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '85' usage: 7.075924 remaining: 3.776224 concurrency: 3<=3<=4
@@ -663,7 +663,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/maxmin_bench small  10 test
 > [0.000000]: [surf_maxmin/DEBUG] '86'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '87'(0.000000) : 0.000000
 > [0.000000]: [surf_maxmin/DEBUG] '90'(0.000000) : 0.000000
-> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 1
+> [0.000000]: [surf_maxmin/DEBUG] Setting selective_update_active flag to 0
 > [0.000000]: [surf_maxmin/DEBUG] Active constraints : 10
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '99' usage: 6.451049 remaining: 0.949051 concurrency: 2<=2<=4
 > [0.000000]: [surf_maxmin/DEBUG] Constraint '94' usage: 4.122378 remaining: 4.585415 concurrency: 2<=3<=4