Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
have the maxmin system create by itself what it needs for selective update
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 31 Mar 2018 14:37:23 +0000 (16:37 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 31 Mar 2018 14:37:28 +0000 (16:37 +0200)
Earlier, the modified_set was created externally by some models (but
not all). This lead to the interesting situation where we were asking
for selective update with the boolean field, but not getting this
because the modified_set was not existing.

Now that we get it when we ask for it, we detect that:
- the lmm_usage tests cannot activate selective_update because they
  don't have real actions, so they cannot track them to see which were
  modified.
- Storage is having selective updates, but with full algorithm (thus
  the change to Action::~Action() so that we deal when selective is on
  but not Lazy). No idea of whether this is the wanted behavior.

src/kernel/lmm/maxmin.cpp
src/kernel/resource/Action.cpp
src/surf/StorageImpl.hpp
src/surf/cpu_cas01.cpp
src/surf/network_cm02.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 bdef76e..002b9c0 100644 (file)
@@ -151,6 +151,9 @@ void System::var_free(Variable* var)
 System::System(bool selective_update) : selective_update_active(selective_update)
 {
   XBT_DEBUG("Setting selective_update_active flag to %d", selective_update_active);
+
+  if (selective_update)
+    modified_set_ = new kernel::resource::Action::ModifiedSet();
 }
 
 System::~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 9b3610f..e16fb4d 100644 (file)
@@ -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 9d3213d..01a1e85 100644 (file)
@@ -73,9 +73,6 @@ CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid
   }
 
   set_maxmin_system(new simgrid::kernel::lmm::System(select));
-
-  if (algo == Model::UpdateAlgo::Lazy)
-    get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
 }
 
 CpuCas01Model::~CpuCas01Model()
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 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