Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
selectiveUpdate is a bool
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 2 Oct 2016 16:17:03 +0000 (18:17 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 2 Oct 2016 16:17:03 +0000 (18:17 +0200)
src/include/surf/maxmin.h
src/surf/cpu_cas01.cpp
src/surf/maxmin.cpp
src/surf/maxmin_private.hpp
src/surf/network_cm02.cpp
src/surf/ptask_L07.cpp
src/surf/storage_n11.cpp
src/surf/surf_interface.hpp

index 29b4369..9698c0f 100644 (file)
@@ -153,9 +153,9 @@ SG_BEGIN_DECL()
 /** @{ @ingroup SURF_lmm */
 /**
  * @brief Create a new Linear MaxMim system
- * @param selective_update [description]
+ * @param selective_update whether we should do lazy updates
  */
-XBT_PUBLIC(lmm_system_t) lmm_system_new(int selective_update);
+XBT_PUBLIC(lmm_system_t) lmm_system_new(bool selective_update);
 
 /**
  * @brief Free an existing Linear MaxMin system
index 50c92d0..2170743 100644 (file)
@@ -38,16 +38,15 @@ namespace surf {
 CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel()
 {
   char *optim = xbt_cfg_get_string("cpu/optim");
-  int select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");
+  bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");
 
   if (!strcmp(optim, "Full")) {
     updateMechanism_ = UM_FULL;
     selectiveUpdate_ = select;
   } else if (!strcmp(optim, "Lazy")) {
     updateMechanism_ = UM_LAZY;
-    selectiveUpdate_ = 1;
-    xbt_assert((select == 1)
-               || (xbt_cfg_is_default_value("cpu/maxmin-selective-update")),
+    selectiveUpdate_ = true;
+    xbt_assert(select || (xbt_cfg_is_default_value("cpu/maxmin-selective-update")),
                "Disabling selective update while using the lazy update mechanism is dumb!");
   } else {
     xbt_die("Unsupported optimization (%s) for this model", optim);
index 563a062..623a3b2 100644 (file)
@@ -74,7 +74,7 @@ inline void lmm_increase_concurrency(lmm_element_t elem) {
              "Concurrency limit overflow!");
 }
 
-lmm_system_t lmm_system_new(int selective_update)
+lmm_system_t lmm_system_new(bool selective_update)
 {
   lmm_system_t l = nullptr;
   s_lmm_variable_t var;
index 740b2c1..9b0a321 100644 (file)
@@ -107,7 +107,7 @@ typedef struct lmm_variable {
  */
 typedef struct lmm_system {
   int modified;
-  int selective_update_active;  /* flag to update partially the system only selecting changed portions */
+  bool selective_update_active;  /* flag to update partially the system only selecting changed portions */
   unsigned visited_counter;     /* used by lmm_update_modified_set  and lmm_remove_modified_set to cleverly (un-)flag the constraints (more details in these functions)*/
   s_xbt_swag_t variable_set;    /* a list of lmm_variable_t */
   s_xbt_swag_t constraint_set;  /* a list of lmm_constraint_t */
index d9057a4..1721e4c 100644 (file)
@@ -136,16 +136,16 @@ NetworkCm02Model::NetworkCm02Model()
   :NetworkModel()
 {
   char *optim = xbt_cfg_get_string("network/optim");
-  int select = xbt_cfg_get_boolean("network/maxmin-selective-update");
+  bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
 
   if (!strcmp(optim, "Full")) {
     updateMechanism_ = UM_FULL;
     selectiveUpdate_ = select;
   } else if (!strcmp(optim, "Lazy")) {
     updateMechanism_ = UM_LAZY;
-    selectiveUpdate_ = 1;
-    xbt_assert((select == 1) || (xbt_cfg_is_default_value("network/maxmin-selective-update")),
-               "You cannot disable selective update while using the lazy update mechanism!");
+    selectiveUpdate_ = true;
+    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);
   }
index c2ab8f0..e2392f1 100644 (file)
@@ -35,7 +35,7 @@ namespace simgrid {
 namespace surf {
 
 HostL07Model::HostL07Model() : HostModel() {
-  maxminSystem_ = lmm_system_new(1);
+  maxminSystem_ = lmm_system_new(true /* lazy */);
   maxminSystem_->solve_fun = &bottleneck_solve;
   surf_network_model = new NetworkL07Model(this,maxminSystem_);
   surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
index 7d88c8f..3fe2701 100644 (file)
@@ -9,7 +9,6 @@
 #include <math.h> /*ceil*/
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_storage);
 
-static int storage_selective_update = 0;
 static xbt_swag_t storage_running_action_set_that_does_not_need_being_checked = nullptr;
 
 /*************
@@ -69,9 +68,8 @@ StorageN11Model::StorageN11Model() : StorageModel() {
   XBT_DEBUG("surf_storage_model_init_internal");
 
   storage_running_action_set_that_does_not_need_being_checked = xbt_swag_new(xbt_swag_offset(*action, stateHookup_));
-  if (!maxminSystem_) {
-    maxminSystem_ = lmm_system_new(storage_selective_update);
-  }
+  if (!maxminSystem_)
+    maxminSystem_ = lmm_system_new(false /*lazy?*/);
 }
 
 StorageN11Model::~StorageN11Model(){
index 228c06d..6f99474 100644 (file)
@@ -348,7 +348,7 @@ protected:
   ActionLmmListPtr modifiedSet_;
   lmm_system_t maxminSystem_ = nullptr;
   e_UM_t updateMechanism_ = UM_UNDEFINED;
-  int selectiveUpdate_;
+  bool selectiveUpdate_;
   xbt_heap_t actionHeap_;
 
 private: