X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ea74f5d95928a521a588737e81f1de94eef25d19..8e70d54a095cd7779a53c7a164f775f7a37b29e5:/src/kernel/lmm/fair_bottleneck.cpp diff --git a/src/kernel/lmm/fair_bottleneck.cpp b/src/kernel/lmm/fair_bottleneck.cpp index 3d027819a9..931a16b40a 100644 --- a/src/kernel/lmm/fair_bottleneck.cpp +++ b/src/kernel/lmm/fair_bottleneck.cpp @@ -1,10 +1,10 @@ -/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "src/kernel/lmm/maxmin.hpp" -#include "src/surf/surf_interface.hpp" +#include "src/kernel/lmm/fair_bottleneck.hpp" +#include "simgrid/math_utils.h" #include "xbt/sysdep.h" #include @@ -13,13 +13,10 @@ #include #include -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_maxmin); +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ker_lmm); -void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve() +void simgrid::kernel::lmm::FairBottleneck::do_solve() { - if (not modified_) - return; - XBT_DEBUG("Variable set : %zu", variable_set.size()); for (Variable& var : variable_set) { var.value_ = 0.0; @@ -36,9 +33,8 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve() } XBT_DEBUG("Active constraints : %zu", active_constraint_set.size()); - for (Constraint& cnst : active_constraint_set) { - saturated_constraint_set.push_back(cnst); - } + saturated_constraint_set.insert(saturated_constraint_set.end(), active_constraint_set.begin(), + active_constraint_set.end()); for (Constraint& cnst : saturated_constraint_set) { cnst.remaining_ = cnst.bound_; cnst.usage_ = 0.0; @@ -52,7 +48,7 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve() auto& var_list = saturated_variable_set; auto& cnst_list = saturated_constraint_set; do { - if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) { + if (XBT_LOG_ISENABLED(ker_lmm, xbt_log_priority_debug)) { XBT_DEBUG("Fair bottleneck done"); print(); } @@ -107,7 +103,7 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_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_) { @@ -117,7 +113,7 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_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_); @@ -140,9 +136,4 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve() } while (not var_list.empty()); cnst_list.clear(); - modified_ = true; - if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) { - XBT_DEBUG("Fair bottleneck done"); - print(); - } }