From 99cc570bb5718475bd7b0bca233503b1ffbc9135 Mon Sep 17 00:00:00 2001 From: Bruno Donassolo Date: Fri, 18 Mar 2022 18:30:41 +0100 Subject: [PATCH] Kill set_concurrency_share --- src/kernel/lmm/System.cpp | 9 +++------ src/kernel/lmm/System.hpp | 9 +-------- src/surf/network_cm02.cpp | 3 --- teshsuite/surf/maxmin_bench/maxmin_bench.cpp | 1 - 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/kernel/lmm/System.cpp b/src/kernel/lmm/System.cpp index 6c5824cea1..97e4c27037 100644 --- a/src/kernel/lmm/System.cpp +++ b/src/kernel/lmm/System.cpp @@ -103,7 +103,7 @@ void System::check_concurrency() const for (Element const& elem : cnst.disabled_element_set_) { // We should have staged variables only if concurrency is reached in some constraint xbt_assert(cnst.get_concurrency_limit() < 0 || elem.variable->staged_penalty_ == 0 || - elem.variable->get_min_concurrency_slack() < elem.variable->concurrency_share_, + elem.variable->get_min_concurrency_slack() == 0, "should not have staged variable!"); } @@ -506,7 +506,6 @@ void Variable::initialize(resource::Action* id_value, double sharing_penalty, do sharing_penalty_ = sharing_penalty; staged_penalty_ = 0.0; bound_ = bound_value; - concurrency_share_ = 1; value_ = 0.0; visited_ = visited_value; mu_ = 0.0; @@ -645,10 +644,8 @@ void System::update_variable_penalty(Variable* var, double penalty) if (enabling_var) { var->staged_penalty_ = penalty; int minslack = var->get_min_concurrency_slack(); - if (minslack < var->concurrency_share_) { - XBT_DEBUG("Staging var (instead of enabling) because min concurrency slack %i, with penalty %f and concurrency" - " share %i", - minslack, penalty, var->concurrency_share_); + if (minslack == 0) { + XBT_DEBUG("Staging var (instead of enabling) because min concurrency slack is 0"); return; } XBT_DEBUG("Enabling var with min concurrency slack %i", minslack); diff --git a/src/kernel/lmm/System.hpp b/src/kernel/lmm/System.hpp index e58e7ede06..bb73e9d714 100644 --- a/src/kernel/lmm/System.hpp +++ b/src/kernel/lmm/System.hpp @@ -319,12 +319,6 @@ public: /** @brief Get the maximum value of the variable (-1.0 if no specified maximum) */ double get_bound() const { return bound_; } - /** - * @brief Set the concurrent share of the variable - * @param value The new concurrency share - */ - void set_concurrency_share(short int value) { concurrency_share_ = value; } - /** * @brief Get the numth constraint associated to the variable * @param num The rank of constraint we want to get @@ -357,7 +351,7 @@ public: /** @brief Check if a variable can be enabled * Make sure to set staged_penalty before, if your intent is only to check concurrency */ - bool can_enable() const { return staged_penalty_ > 0 && get_min_concurrency_slack() >= concurrency_share_; } + bool can_enable() const { return staged_penalty_ > 0 && get_min_concurrency_slack() > 0; } /* hookup to system */ boost::intrusive::list_member_hook<> variable_set_hook_; @@ -375,7 +369,6 @@ public: met */ double bound_; double value_; - short int concurrency_share_; /* The maximum number of elements that variable will add to a constraint */ resource::Action* id_; int rank_; // Only used in debug messages to identify the variable unsigned visited_; /* used by System::update_modified_cnst_set() */ diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 5f21418e23..8d1b395fe7 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -263,9 +263,6 @@ void NetworkCm02Model::comm_action_expand_constraints(const s4u::Host* src, cons if (link->get_sharing_policy() != s4u::Link::SharingPolicy::WIFI) get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), .05); } - // Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency - // (You would also have to change simgrid::kernel::lmm::Element::get_concurrency()) - // action->getVariable()->set_concurrency_share(2) } } diff --git a/teshsuite/surf/maxmin_bench/maxmin_bench.cpp b/teshsuite/surf/maxmin_bench/maxmin_bench.cpp index 5bced38219..0836e4b884 100644 --- a/teshsuite/surf/maxmin_bench/maxmin_bench.cpp +++ b/teshsuite/surf/maxmin_bench/maxmin_bench.cpp @@ -43,7 +43,6 @@ static double test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_li var = Sys.variable_new(nullptr, 1.0, -1.0, nb_elem); //Have a few variables with a concurrency share of two (e.g. cross-traffic in some cases) short concurrency_share = 1 + static_cast(simgrid::xbt::random::uniform_int(0, max_share - 1)); - var->set_concurrency_share(concurrency_share); std::vector used(nb_cnst, 0); for (int j = 0; j < nb_elem; j++) { -- 2.20.1