From c0a120daf1586f88922362265dc53f93228f61d9 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 17 Feb 2023 00:01:45 +0100 Subject: [PATCH] Rename option maxmin/precision to precision/work-amount for clarity --- ChangeLog | 1 + docs/source/Configuring_SimGrid.rst | 6 +- docs/source/XML_reference.rst | 2 +- examples/platforms/config.xml | 2 +- src/kernel/lmm/System.cpp | 6 +- src/kernel/lmm/bmf.cpp | 8 +- src/kernel/lmm/bmf_test.cpp | 84 +++++++++---------- src/kernel/lmm/fair_bottleneck.cpp | 4 +- src/kernel/lmm/maxmin.cpp | 29 +++---- src/kernel/lmm/maxmin_test.cpp | 62 +++++++------- src/kernel/resource/Action.cpp | 2 +- src/simgrid/sg_config.cpp | 4 +- src/surf/cpu_ti.cpp | 2 +- src/surf/surf_interface.hpp | 2 +- teshsuite/platforms/properties.xml | 2 +- .../basic-parsing-test.tesh | 4 +- 16 files changed, 111 insertions(+), 109 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9f5e31f7a..30e8baf1f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,7 @@ Models: - Finally kill the 'compound' host model. You can change the CPU or network model with the default host model, as it should. - Rename option "surf/precision" to "precision/timing" for clarity. + - Rename option "maxmin/precision" to "precision/work-amount" for clarity. sthread: - Implement pthread_join in MC mode. diff --git a/docs/source/Configuring_SimGrid.rst b/docs/source/Configuring_SimGrid.rst index a2bc3e3c34..172de945d9 100644 --- a/docs/source/Configuring_SimGrid.rst +++ b/docs/source/Configuring_SimGrid.rst @@ -105,7 +105,6 @@ Existing Configuration Items - **host/model:** :ref:`options_model_select` -- **maxmin/precision:** :ref:`cfg=maxmin/precision` - **maxmin/concurrency-limit:** :ref:`cfg=maxmin/concurrency-limit` - **model-check:** :ref:`options_modelchecking` @@ -141,6 +140,7 @@ Existing Configuration Items - **storage/max_file_descriptors:** :ref:`cfg=storage/max_file_descriptors` - **precision/timing:** :ref:`cfg=precision/timing` +- **precision/work-amount:** :ref:`cfg=precision/work-amount` - **For collective operations of SMPI,** please refer to Section :ref:`cfg=smpi/coll-selector` - **smpi/auto-shared-malloc-thresh:** :ref:`cfg=smpi/auto-shared-malloc-thresh` @@ -303,14 +303,14 @@ configurations. and slow pattern that follows the actual dependencies. .. _cfg=bmf/precision: -.. _cfg=maxmin/precision: .. _cfg=precision/timing: +.. _cfg=precision/work-amount: Numerical Precision ................... -**Option** ``maxmin/precision`` **Default:** 1e-5 (in flops or bytes) |br| **Option** ``precision/timing`` **Default:** 1e-9 (in seconds) |br| +**Option** ``precision/work-amount`` **Default:** 1e-5 (in flops or bytes) |br| **Option** ``bmf/precision`` **Default:** 1e-12 (no unit) The analytical models handle a lot of floating point values. It is diff --git a/docs/source/XML_reference.rst b/docs/source/XML_reference.rst index a7619f3ad0..dad879d7bb 100644 --- a/docs/source/XML_reference.rst +++ b/docs/source/XML_reference.rst @@ -132,7 +132,7 @@ name of the flag and ``value`` is what it has to be set to. - + diff --git a/examples/platforms/config.xml b/examples/platforms/config.xml index b524bf174a..6ab64321ad 100644 --- a/examples/platforms/config.xml +++ b/examples/platforms/config.xml @@ -2,7 +2,7 @@ - + diff --git a/src/kernel/lmm/System.cpp b/src/kernel/lmm/System.cpp index a665cfe94a..6664f3a385 100644 --- a/src/kernel/lmm/System.cpp +++ b/src/kernel/lmm/System.cpp @@ -13,7 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_lmm, kernel, "Kernel Linear Max-Min solver"); -double sg_maxmin_precision = 1E-5; /* Change this with --cfg=maxmin/precision:VALUE */ +double sg_precision_workamount = 1E-5; /* Change this with --cfg=precision/work-amount:VALUE */ double sg_precision_timing = 1E-9; /* Change this with --cfg=precision/timing:VALUE */ int sg_concurrency_limit = -1; /* Change this with --cfg=maxmin/concurrency-limit:VALUE */ @@ -426,7 +426,7 @@ void System::print() const } XBT_DEBUG("%s", buf.c_str()); buf.clear(); - xbt_assert(not double_positive(sum - cnst.bound_, cnst.bound_ * sg_maxmin_precision), + xbt_assert(not double_positive(sum - cnst.bound_, cnst.bound_ * sg_precision_workamount), "Incorrect value (%f is not smaller than %f): %g", sum, cnst.bound_, sum - cnst.bound_); } @@ -435,7 +435,7 @@ void System::print() const for (Variable const& var : variable_set) { if (var.bound_ > 0) { XBT_DEBUG("'%d'(%f) : %f (<=%f)", var.rank_, var.sharing_penalty_, var.value_, var.bound_); - xbt_assert(not double_positive(var.value_ - var.bound_, var.bound_ * sg_maxmin_precision), + xbt_assert(not double_positive(var.value_ - var.bound_, var.bound_ * sg_precision_workamount), "Incorrect value (%f is not smaller than %f", var.value_, var.bound_); } else { XBT_DEBUG("'%d'(%f) : %f", var.rank_, var.sharing_penalty_, var.value_); diff --git a/src/kernel/lmm/bmf.cpp b/src/kernel/lmm/bmf.cpp index eb629b4613..b46c8c741e 100644 --- a/src/kernel/lmm/bmf.cpp +++ b/src/kernel/lmm/bmf.cpp @@ -309,7 +309,7 @@ bool BmfSolver::is_bmf(const Eigen::VectorXd& rho) const Eigen::VectorXd remaining = (A_ * rho) - C_; remaining = remaining.array() * shared.array(); // ignore non shared resources bmf = bmf && (not std::any_of(remaining.data(), remaining.data() + remaining.size(), - [](double v) { return double_positive(v, sg_maxmin_precision); })); + [](double v) { return double_positive(v, sg_precision_workamount); })); // 3) every player receives maximum share in at least 1 saturated resource // due to subflows, compare with the maximum consumption and not the A matrix @@ -321,15 +321,15 @@ bool BmfSolver::is_bmf(const Eigen::VectorXd& rho) const // matrix_ji: boolean indicating player p has the maximum share at resource j Eigen::MatrixXi player_max_share = - ((usage.array().colwise() - max_share.array()).abs() <= sg_maxmin_precision).cast(); + ((usage.array().colwise() - max_share.array()).abs() <= sg_precision_workamount).cast(); // but only saturated resources must be considered - Eigen::VectorXi saturated = (remaining.array().abs() <= sg_maxmin_precision).cast(); + Eigen::VectorXi saturated = (remaining.array().abs() <= sg_precision_workamount).cast(); XBT_DEBUG("Saturated_j resources:\n%s", debug_eigen(saturated).c_str()); player_max_share.array().colwise() *= saturated.array(); // just check if it has received at least it's bound for (int p = 0; p < rho.size(); p++) { - if (double_equals(rho[p], phi_[p], sg_maxmin_precision)) { + if (double_equals(rho[p], phi_[p], sg_precision_workamount)) { player_max_share(0, p) = 1; // it doesn't really matter, just to say that it's a bmf saturated[0] = 1; } diff --git a/src/kernel/lmm/bmf_test.cpp b/src/kernel/lmm/bmf_test.cpp index ffaf589b70..2306af95c2 100644 --- a/src/kernel/lmm/bmf_test.cpp +++ b/src/kernel/lmm/bmf_test.cpp @@ -34,7 +34,7 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") Sys.expand(sys_cnst, rho_1, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 3, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 3, sg_precision_workamount)); } SECTION("Two flows") @@ -60,8 +60,8 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") Sys.expand(sys_cnst, rho_2, 10); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 3.0 / 2.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), (3.0 / 2.0) / 10.0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 3.0 / 2.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), (3.0 / 2.0) / 10.0, sg_precision_workamount)); } SECTION("Variable penalty/priority") @@ -87,8 +87,8 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 2.0 / 3.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 1.0 / 3.0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 2.0 / 3.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 1.0 / 3.0, sg_precision_workamount)); } SECTION("Disable variable doesn't count") @@ -113,8 +113,8 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") Sys.expand(sys_cnst, rho_2, 10); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 0.0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 0.0, sg_precision_workamount)); } SECTION("No consumption variable") @@ -138,7 +138,7 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") Sys.expand(sys_cnst, rho_2, 10); Sys.solve(); - REQUIRE(double_positive(rho_1->get_value(), sg_maxmin_precision)); + REQUIRE(double_positive(rho_1->get_value(), sg_precision_workamount)); } SECTION("Bounded variable") @@ -163,8 +163,8 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") Sys.expand(sys_cnst, rho_1, 2); Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), .1, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), .8, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), .1, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), .8, sg_precision_workamount)); } SECTION("Fatpipe") @@ -191,8 +191,8 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 3.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 3.0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 3.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 3.0, sg_precision_workamount)); } SECTION("(un)Bounded variable") @@ -217,8 +217,8 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") Sys.expand(sys_cnst, rho_1, 1); Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), .5, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), .5, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), .5, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), .5, sg_precision_workamount)); } SECTION("Dynamic bounds") @@ -242,15 +242,15 @@ TEST_CASE("kernel::bmf Basic tests", "[kernel-bmf-basic]") lmm::Variable* rho_1 = Sys.variable_new(nullptr, 1); Sys.expand(sys_cnst, rho_1, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1, sg_precision_workamount)); // add another variable, half initial capacity lmm::Variable* rho_2 = Sys.variable_new(nullptr, 1); Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), .25, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), .25, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), .25, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), .25, sg_precision_workamount)); } Sys.variable_free_all(); @@ -291,8 +291,8 @@ TEST_CASE("kernel::bmf Advanced tests", "[kernel-bmf-advanced]") Sys.expand(sys_cnst2, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1.0 / 11.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 1.0 / 11.0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1.0 / 11.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 1.0 / 11.0, sg_precision_workamount)); } SECTION("BMF paper example") @@ -327,9 +327,9 @@ TEST_CASE("kernel::bmf Advanced tests", "[kernel-bmf-advanced]") Sys.expand(sys_cnst3, rho_3, 3.0 / 4.0); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1.0 / 3.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 4.0 / 9.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_3->get_value(), 4.0 / 9.0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1.0 / 3.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 4.0 / 9.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_3->get_value(), 4.0 / 9.0, sg_precision_workamount)); } SECTION("IO - example") @@ -368,8 +368,8 @@ TEST_CASE("kernel::bmf Advanced tests", "[kernel-bmf-advanced]") Sys.expand(sys_cnst3, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1e6 / 2.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 1e6 / 2.0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1e6 / 2.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 1e6 / 2.0, sg_precision_workamount)); } SECTION("Proportional fairness") @@ -398,9 +398,9 @@ TEST_CASE("kernel::bmf Advanced tests", "[kernel-bmf-advanced]") Sys.expand(sys_cnst, rho_3, epsilon); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1.0 / (2.0 + 2 * epsilon), sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 1.0 / (2.0 + 2 * epsilon), sg_maxmin_precision)); - REQUIRE(double_equals(rho_3->get_value(), 1.0 / (1.0 + epsilon), sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1.0 / (2.0 + 2 * epsilon), sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 1.0 / (2.0 + 2 * epsilon), sg_precision_workamount)); + REQUIRE(double_equals(rho_3->get_value(), 1.0 / (1.0 + epsilon), sg_precision_workamount)); } Sys.variable_free_all(); @@ -440,8 +440,8 @@ TEST_CASE("kernel::bmf Subflows", "[kernel-bmf-subflow]") Sys.expand(sys_cnst, rho_2, 5); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 5.0 / 24.0, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 5.0 / 24.0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 5.0 / 24.0, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 5.0 / 24.0, sg_precision_workamount)); } SECTION("1 subflows, 1 flow and 1 resource") @@ -475,9 +475,9 @@ TEST_CASE("kernel::bmf Subflows", "[kernel-bmf-subflow]") Sys.expand(sys_cnst, rho_2, 10); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), (5.0 / 25.0), sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), (5.0 / 25.0), sg_maxmin_precision)); - REQUIRE(double_equals(15 * rho_1->get_value(), 10 * rho_2->get_value() * 3 / 2, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), (5.0 / 25.0), sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), (5.0 / 25.0), sg_precision_workamount)); + REQUIRE(double_equals(15 * rho_1->get_value(), 10 * rho_2->get_value() * 3 / 2, sg_precision_workamount)); } SECTION("1 subflows using 2 resources: different max for each resource") @@ -513,8 +513,8 @@ TEST_CASE("kernel::bmf Subflows", "[kernel-bmf-subflow]") Sys.expand(sys_cnst2, rho_2, 3.0 / 2.0); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), (1.0 / 3.0), sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), (1.0 / 3.0), sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), (1.0 / 3.0), sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), (1.0 / 3.0), sg_precision_workamount)); } Sys.variable_free_all(); @@ -556,7 +556,7 @@ TEST_CASE("kernel::bmf Loop", "[kernel-bmf-loop]") Sys.solve(); for (const auto* rho : vars) { - REQUIRE(double_positive(rho->get_value(), sg_maxmin_precision)); + REQUIRE(double_positive(rho->get_value(), sg_precision_workamount)); } } @@ -655,8 +655,8 @@ TEST_CASE("kernel::bmf Bugs", "[kernel-bmf-bug]") Sys.expand(sys_cnst, rho_2, 1.0); Sys.expand(sys_cnst2, rho_2, 1.0); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1.4, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 3, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1.4, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 3, sg_precision_workamount)); } SECTION("s4u-cloud-capping bug: all limited by bound extra case") @@ -675,8 +675,8 @@ TEST_CASE("kernel::bmf Bugs", "[kernel-bmf-bug]") Sys.expand(sys_cnst, rho_1, 1); Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 7.6296e+06, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 3.8148e+07, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 7.6296e+06, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 3.8148e+07, sg_precision_workamount)); } SECTION("Variable penalty with bounds: thread bug") @@ -694,8 +694,8 @@ TEST_CASE("kernel::bmf Bugs", "[kernel-bmf-bug]") Sys.expand(sys_cnst, rho_1, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 8e7, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 3.2e8, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 8e7, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 3.2e8, sg_precision_workamount)); } SECTION("Variable penalty with bounds greater than C") @@ -709,7 +709,7 @@ TEST_CASE("kernel::bmf Bugs", "[kernel-bmf-bug]") Sys.expand(sys_cnst, rho_1, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 4e8, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 4e8, sg_precision_workamount)); } Sys.variable_free_all(); diff --git a/src/kernel/lmm/fair_bottleneck.cpp b/src/kernel/lmm/fair_bottleneck.cpp index 2f9c2e7f63..c9cd24c68b 100644 --- a/src/kernel/lmm/fair_bottleneck.cpp +++ b/src/kernel/lmm/fair_bottleneck.cpp @@ -103,7 +103,7 @@ void simgrid::kernel::lmm::FairBottleneck::do_solve() xbt_assert(elem.variable->sharing_penalty_ > 0); XBT_DEBUG("\tUpdate constraint %p (%g) with variable %p by %g", &cnst, cnst.remaining_, elem.variable, elem.variable->mu_); - double_update(&cnst.remaining_, elem.consumption_weight * elem.variable->mu_, sg_maxmin_precision); + double_update(&cnst.remaining_, elem.consumption_weight * elem.variable->mu_, sg_precision_workamount); } } else { for (const Element& elem : cnst.enabled_element_set_) { @@ -113,7 +113,7 @@ void simgrid::kernel::lmm::FairBottleneck::do_solve() cnst.usage_ = std::min(cnst.usage_, elem.consumption_weight * elem.variable->mu_); } XBT_DEBUG("\tUpdate constraint %p (%g) by %g", &cnst, cnst.remaining_, cnst.usage_); - double_update(&cnst.remaining_, cnst.usage_, sg_maxmin_precision); + double_update(&cnst.remaining_, cnst.usage_, sg_precision_workamount); } XBT_DEBUG("\tRemaining for %p : %g", &cnst, cnst.remaining_); diff --git a/src/kernel/lmm/maxmin.cpp b/src/kernel/lmm/maxmin.cpp index 7cbe6cf695..574bef20cb 100644 --- a/src/kernel/lmm/maxmin.cpp +++ b/src/kernel/lmm/maxmin.cpp @@ -71,7 +71,7 @@ template void MaxMin::maxmin_solve(CnstList& cnst_list) cnst.dynamic_bound_ = cnst.dyn_constraint_cb_(cnst.bound_, cnst.concurrency_current_); } cnst.remaining_ = cnst.dynamic_bound_; - if (not double_positive(cnst.remaining_, cnst.dynamic_bound_ * sg_maxmin_precision)) + if (not double_positive(cnst.remaining_, cnst.dynamic_bound_ * sg_precision_workamount)) continue; cnst.usage_ = 0; for (Element& elem : cnst.enabled_element_set_) { @@ -132,7 +132,7 @@ template void MaxMin::maxmin_solve(CnstList& cnst_list) XBT_DEBUG("Setting var (%d) value to %f\n", var.rank_, var.value_); } else { // If there exist a variable that can reach its bound, only update it (and other with the same bound) for now. - if (double_equals(min_bound, var.bound_ * var.sharing_penalty_, sg_maxmin_precision)) { + if (double_equals(min_bound, var.bound_ * var.sharing_penalty_, sg_precision_workamount)) { var.value_ = var.bound_; XBT_DEBUG("Setting %p (%d) value to %f\n", &var, var.rank_, var.value_); } else { @@ -151,11 +151,11 @@ template void MaxMin::maxmin_solve(CnstList& cnst_list) if (cnst->sharing_policy_ != Constraint::SharingPolicy::FATPIPE) { // Remember: shared constraints require that sum(elem.value * var.value) < cnst->bound double_update(&(cnst->remaining_), elem.consumption_weight * var.value_, - cnst->dynamic_bound_ * sg_maxmin_precision); - double_update(&(cnst->usage_), elem.consumption_weight / var.sharing_penalty_, sg_maxmin_precision); + cnst->dynamic_bound_ * sg_precision_workamount); + double_update(&(cnst->usage_), elem.consumption_weight / var.sharing_penalty_, sg_precision_workamount); // If the constraint is saturated, remove it from the set of active constraints (light_tab) - if (not double_positive(cnst->usage_, sg_maxmin_precision) || - not double_positive(cnst->remaining_, cnst->dynamic_bound_ * sg_maxmin_precision)) { + if (not double_positive(cnst->usage_, sg_precision_workamount) || + not double_positive(cnst->remaining_, cnst->dynamic_bound_ * sg_precision_workamount)) { if (cnst->cnst_light_) { size_t index = (cnst->cnst_light_ - cnst_light_tab); XBT_DEBUG("index: %zu \t cnst_light_num: %d \t || usage: %f remaining: %f bound: %f", index, @@ -183,8 +183,8 @@ template void MaxMin::maxmin_solve(CnstList& cnst_list) cnst->usage_ = std::max(cnst->usage_, elem2.consumption_weight / elem2.variable->sharing_penalty_); } // If the constraint is saturated, remove it from the set of active constraints (light_tab) - if (not double_positive(cnst->usage_, sg_maxmin_precision) || - not double_positive(cnst->remaining_, cnst->dynamic_bound_ * sg_maxmin_precision)) { + if (not double_positive(cnst->usage_, sg_precision_workamount) || + not double_positive(cnst->remaining_, cnst->dynamic_bound_ * sg_precision_workamount)) { if (cnst->cnst_light_) { size_t index = (cnst->cnst_light_ - cnst_light_tab); XBT_DEBUG("index: %zu \t cnst_light_num: %d \t || \t cnst: %p \t cnst->cnst_light: %p " @@ -214,12 +214,13 @@ template void MaxMin::maxmin_solve(CnstList& cnst_list) min_bound = -1; saturated_constraints.clear(); for (int pos = 0; pos < cnst_light_num; pos++) { - xbt_assert(not cnst_light_tab[pos].cnst->active_element_set_.empty(), - "Cannot saturate more a constraint that has" - " no active element! You may want to change the maxmin precision (--cfg=maxmin/precision:)" - " because of possible rounding effects.\n\tFor the record, the usage of this constraint is %g while " - "the maxmin precision to which it is compared is %g.\n\tThe usage of the previous constraint is %g.", - cnst_light_tab[pos].cnst->usage_, sg_maxmin_precision, cnst_light_tab[pos - 1].cnst->usage_); + xbt_assert( + not cnst_light_tab[pos].cnst->active_element_set_.empty(), + "Cannot saturate more a constraint that has" + " no active element! You may want to change the work amount precision (--cfg=precision/work:)" + " because of possible rounding effects.\n\tFor the record, the usage of this constraint is %g while " + "the maxmin precision to which it is compared is %g.\n\tThe usage of the previous constraint is %g.", + cnst_light_tab[pos].cnst->usage_, sg_precision_workamount, cnst_light_tab[pos - 1].cnst->usage_); saturated_constraints_update(cnst_light_tab[pos].remaining_over_usage, pos, saturated_constraints, &min_usage); } diff --git a/src/kernel/lmm/maxmin_test.cpp b/src/kernel/lmm/maxmin_test.cpp index dd34cd03bc..1ef58cc2ba 100644 --- a/src/kernel/lmm/maxmin_test.cpp +++ b/src/kernel/lmm/maxmin_test.cpp @@ -37,8 +37,8 @@ TEST_CASE("kernel::lmm Single constraint shared systems", "[kernel-lmm-shared-si Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 2, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 1, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 2, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 1, sg_precision_workamount)); } SECTION("Consumption weight") @@ -65,8 +65,8 @@ TEST_CASE("kernel::lmm Single constraint shared systems", "[kernel-lmm-shared-si Sys.expand(sys_cnst, rho_2, 2); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 1, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 1, sg_precision_workamount)); } SECTION("Consumption weight + variable penalty") @@ -94,8 +94,8 @@ TEST_CASE("kernel::lmm Single constraint shared systems", "[kernel-lmm-shared-si Sys.solve(); double rho_1_share = 10; - REQUIRE(double_equals(rho_1->get_value(), rho_1_share, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), rho_1_share / 2, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), rho_1_share, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), rho_1_share / 2, sg_precision_workamount)); } SECTION("Multiple constraints systems") @@ -134,9 +134,9 @@ TEST_CASE("kernel::lmm Single constraint shared systems", "[kernel-lmm-shared-si Sys.solve(); double rho_1_share = 10; // Start by solving the first constraint (results is the same as previous tests) - REQUIRE(double_equals(rho_1->get_value(), rho_1_share, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), rho_1_share / 2, sg_maxmin_precision)); - REQUIRE(double_equals(rho_3->get_value(), 60 - 2 * rho_1_share, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), rho_1_share, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), rho_1_share / 2, sg_precision_workamount)); + REQUIRE(double_equals(rho_3->get_value(), 60 - 2 * rho_1_share, sg_precision_workamount)); } Sys.variable_free_all(); @@ -171,8 +171,8 @@ TEST_CASE("kernel::lmm Single constraint unshared systems", "[kernel-lmm-unshare Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 10, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 10 / 2, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 10, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 10 / 2, sg_precision_workamount)); } SECTION("Consumption weight") @@ -201,8 +201,8 @@ TEST_CASE("kernel::lmm Single constraint unshared systems", "[kernel-lmm-unshare Sys.expand(sys_cnst, rho_2, 2); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 5, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 5, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 5, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 5, sg_precision_workamount)); } SECTION("Consumption weight + variable penalty") @@ -231,8 +231,8 @@ TEST_CASE("kernel::lmm Single constraint unshared systems", "[kernel-lmm-unshare Sys.expand(sys_cnst, sys_var_2, 2); Sys.solve(); - REQUIRE(double_equals(sys_var_1->get_value(), 10, sg_maxmin_precision)); - REQUIRE(double_equals(sys_var_2->get_value(), 5, sg_maxmin_precision)); + REQUIRE(double_equals(sys_var_1->get_value(), 10, sg_precision_workamount)); + REQUIRE(double_equals(sys_var_2->get_value(), 5, sg_precision_workamount)); } SECTION("Multiple constraints systems") @@ -273,9 +273,9 @@ TEST_CASE("kernel::lmm Single constraint unshared systems", "[kernel-lmm-unshare Sys.solve(); double rho_1_share = 10; // Start by solving the first constraint (results is the same as previous tests) - REQUIRE(double_equals(rho_1->get_value(), rho_1_share, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), rho_1_share / 2, sg_maxmin_precision)); - REQUIRE(double_equals(rho_3->get_value(), 60, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), rho_1_share, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), rho_1_share / 2, sg_precision_workamount)); + REQUIRE(double_equals(rho_3->get_value(), 60, sg_precision_workamount)); } Sys.variable_free_all(); @@ -310,7 +310,7 @@ TEST_CASE("kernel::lmm dynamic constraint shared systems", "[kernel-lmm-shared-s Sys.expand(sys_cnst, rho_1, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 10, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 10, sg_precision_workamount)); } SECTION("2 activities, but ignore crosstraffic 100% C") @@ -336,8 +336,8 @@ TEST_CASE("kernel::lmm dynamic constraint shared systems", "[kernel-lmm-shared-s Sys.expand(sys_cnst, rho_2, 0.05); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 10 / 1.05, sg_maxmin_precision)); - REQUIRE(double_equals(rho_1->get_value(), rho_2->get_value(), sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 10 / 1.05, sg_precision_workamount)); + REQUIRE(double_equals(rho_1->get_value(), rho_2->get_value(), sg_precision_workamount)); } SECTION("2 activities, 1 inactive 100% C") @@ -362,8 +362,8 @@ TEST_CASE("kernel::lmm dynamic constraint shared systems", "[kernel-lmm-shared-s Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 10, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 0, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 10, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 0, sg_precision_workamount)); } SECTION("2 activity, 90% C") @@ -388,8 +388,8 @@ TEST_CASE("kernel::lmm dynamic constraint shared systems", "[kernel-lmm-shared-s Sys.expand(sys_cnst, rho_2, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 4.5, sg_maxmin_precision)); - REQUIRE(double_equals(rho_1->get_value(), 4.5, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 4.5, sg_precision_workamount)); + REQUIRE(double_equals(rho_1->get_value(), 4.5, sg_precision_workamount)); } SECTION("3 activity, 80% C") @@ -417,9 +417,9 @@ TEST_CASE("kernel::lmm dynamic constraint shared systems", "[kernel-lmm-shared-s Sys.expand(sys_cnst, rho_3, 1); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 4, sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 2, sg_maxmin_precision)); - REQUIRE(double_equals(rho_3->get_value(), 2, sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 4, sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 2, sg_precision_workamount)); + REQUIRE(double_equals(rho_3->get_value(), 2, sg_precision_workamount)); } Sys.variable_free_all(); @@ -458,9 +458,9 @@ TEST_CASE("kernel::lmm shared systems with crosstraffic", "[kernel-lmm-shared-cr Sys.expand(sys_cnst, rho_3, epsilon); Sys.solve(); - REQUIRE(double_equals(rho_1->get_value(), 1.0 / (2.0 + epsilon), sg_maxmin_precision)); - REQUIRE(double_equals(rho_2->get_value(), 1.0 / (2.0 + epsilon), sg_maxmin_precision)); - REQUIRE(double_equals(rho_3->get_value(), 1.0 / (2.0 + epsilon), sg_maxmin_precision)); + REQUIRE(double_equals(rho_1->get_value(), 1.0 / (2.0 + epsilon), sg_precision_workamount)); + REQUIRE(double_equals(rho_2->get_value(), 1.0 / (2.0 + epsilon), sg_precision_workamount)); + REQUIRE(double_equals(rho_3->get_value(), 1.0 / (2.0 + epsilon), sg_precision_workamount)); } Sys.variable_free_all(); diff --git a/src/kernel/resource/Action.cpp b/src/kernel/resource/Action.cpp index ed431b7449..8ca52bddbd 100644 --- a/src/kernel/resource/Action.cpp +++ b/src/kernel/resource/Action.cpp @@ -199,7 +199,7 @@ void Action::update_max_duration(double delta) void Action::update_remains(double delta) { - double_update(&remains_, delta, sg_maxmin_precision * sg_precision_timing); + double_update(&remains_, delta, sg_precision_workamount * sg_precision_timing); } void Action::set_last_update() diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index dc2fd84689..44e982da38 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -139,7 +139,7 @@ void sg_config_init(int *argc, char **argv) return; } - /* Plugins configuration */ + /* Plugins and models configuration */ simgrid_plugins().create_flag("plugin", "The plugins", "", true); simgrid_cpu_models().create_flag("cpu/model", "The model to use for the CPU", "Cas01", false); simgrid_network_models().create_flag("network/model", "The model to use for the network", "LV08", false); @@ -149,7 +149,7 @@ void sg_config_init(int *argc, char **argv) simgrid::config::bind_flag(sg_precision_timing, "precision/timing", {"surf/precision"}, "Numerical precision used when updating simulation times (in seconds)"); - simgrid::config::bind_flag(sg_maxmin_precision, "maxmin/precision", + simgrid::config::bind_flag(sg_precision_workamount, "precision/work-amount", {"maxmin/precision"}, "Numerical precision used when computing resource sharing (in flops/sec or bytes/sec)"); simgrid::config::bind_flag(sg_concurrency_limit, "maxmin/concurrency-limit", diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 029965abdb..e65a824406 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -120,7 +120,7 @@ double CpuTiProfile::integrate_simple_point(double a) const XBT_DEBUG("a %f ind %ld 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_precision_timing); + double_update(&a_aux, time_points_[ind], sg_precision_workamount * sg_precision_timing); if (a_aux > 0) integral += ((integral_[ind + 1] - integral_[ind]) / (time_points_[ind + 1] - time_points_[ind])) * (a - time_points_[ind]); diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index b5dfbd3c17..a63cd3f2cb 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -26,7 +26,7 @@ *********/ /* user-visible parameters */ -XBT_PUBLIC_DATA double sg_maxmin_precision; +XBT_PUBLIC_DATA double sg_precision_workamount; XBT_PUBLIC_DATA double sg_precision_timing; XBT_PUBLIC_DATA int sg_concurrency_limit; diff --git a/teshsuite/platforms/properties.xml b/teshsuite/platforms/properties.xml index fd238af7af..6f06059e68 100644 --- a/teshsuite/platforms/properties.xml +++ b/teshsuite/platforms/properties.xml @@ -2,7 +2,7 @@ - + diff --git a/teshsuite/s4u/basic-parsing-test/basic-parsing-test.tesh b/teshsuite/s4u/basic-parsing-test/basic-parsing-test.tesh index 66e38a49e5..2a3d976604 100644 --- a/teshsuite/s4u/basic-parsing-test/basic-parsing-test.tesh +++ b/teshsuite/s4u/basic-parsing-test/basic-parsing-test.tesh @@ -37,11 +37,11 @@ $ ${bindir:=.}/basic-parsing-test ${platfdir:=.}/cloud.xml --log=root.fmt=%m%n $ ${bindir:=.}/basic-parsing-test ${srcdir:=.}/../../platforms/properties.xml --log=root.fmt=%m%n > Configuration change: Set 'cpu/optim' to 'TI' -> Configuration change: Set 'maxmin/precision' to '0.000010' +> Configuration change: Set 'precision/work-amount' to '0.000010' > Workstation number: 1, link number: 1 $ ${bindir:=.}/basic-parsing-test ${srcdir:=.}/../../platforms/properties.xml --cfg=cpu/optim:TI --log=root.fmt=%m%n > Configuration change: Set 'cpu/optim' to 'TI' > The custom configuration 'cpu/optim' is already defined by user! -> Configuration change: Set 'maxmin/precision' to '0.000010' +> Configuration change: Set 'precision/work-amount' to '0.000010' > Workstation number: 1, link number: 1 -- 2.20.1