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()
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_);
}
* @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]
}
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()
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,
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");
}
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);
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);
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];
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));
! 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
> [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
> [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
> [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
> [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
! 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
> [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
> [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
> [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
> [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
> [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
> [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
> [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
> [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
> [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