From: Bruno Donassolo Date: Tue, 27 Jul 2021 18:53:35 +0000 (+0200) Subject: Fix set_read_bandwidth and set_write_bandwidth for disks X-Git-Tag: v3.29~175 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/52dde957c5fbacc07b51d5668698acac7b7fb8a9 Fix set_read_bandwidth and set_write_bandwidth for disks - Remove update_penalty method. Disk actions either are suspended or running, this is managed by the Action class already. - Only updating the constraint value seems enough for set_bandwidth functions. - Add a teshsuite for it --- diff --git a/MANIFEST.in b/MANIFEST.in index fcc89b0513..6eee929687 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -737,6 +737,8 @@ include teshsuite/s4u/host-on-off-recv/host-on-off-recv.cpp include teshsuite/s4u/host-on-off-recv/host-on-off-recv.tesh include teshsuite/s4u/host-on-off/host-on-off.cpp include teshsuite/s4u/host-on-off/host-on-off.tesh +include teshsuite/s4u/io-set-bw/io-set-bw.cpp +include teshsuite/s4u/io-set-bw/io-set-bw.tesh include teshsuite/s4u/is-router/is-router.cpp include teshsuite/s4u/is-router/is-router.tesh include teshsuite/s4u/issue71/issue71.cpp diff --git a/src/kernel/lmm/maxmin.cpp b/src/kernel/lmm/maxmin.cpp index 1586f5e3b9..80d0519765 100644 --- a/src/kernel/lmm/maxmin.cpp +++ b/src/kernel/lmm/maxmin.cpp @@ -817,7 +817,6 @@ void System::on_disabled_var(Constraint* cnstr) void System::update_variable_penalty(Variable* var, double penalty) { xbt_assert(penalty >= 0, "Variable penalty should not be negative!"); - if (penalty == var->sharing_penalty_) return; diff --git a/src/kernel/resource/DiskImpl.hpp b/src/kernel/resource/DiskImpl.hpp index 8cd0ca7c50..0351e1dc8e 100644 --- a/src/kernel/resource/DiskImpl.hpp +++ b/src/kernel/resource/DiskImpl.hpp @@ -120,8 +120,6 @@ public: using Action::Action; void set_state(simgrid::kernel::resource::Action::State state) override; - - double sharing_penalty_ = {}; }; } // namespace resource diff --git a/src/surf/disk_s19.cpp b/src/surf/disk_s19.cpp index 6c2e68a5ad..86028dab82 100644 --- a/src/surf/disk_s19.cpp +++ b/src/surf/disk_s19.cpp @@ -71,44 +71,30 @@ DiskAction* DiskS19Model::io_start(const DiskImpl* disk, sg_size_t size, s4u::Io /************ * Resource * ************/ -void DiskS19::update_penalties(double delta) const -{ - const kernel::lmm::Element* elem = nullptr; - const kernel::lmm::Element* nextelem = nullptr; - size_t numelem = 0; - while (const auto* var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem)) { - auto* action = static_cast(var->get_id()); - action->sharing_penalty_ += delta; - if (not action->is_suspended()) - get_model()->get_maxmin_system()->update_variable_penalty(action->get_variable(), action->sharing_penalty_); - } -} - void DiskS19::set_read_bandwidth(double value) { read_bw_.peak = value; - get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), read_bw_.peak * read_bw_.scale); - - double delta = 1.0 / value - 1.0 / (read_bw_.peak * read_bw_.scale); - update_penalties(delta); + if (get_read_constraint()) { + get_model()->get_maxmin_system()->update_constraint_bound(get_read_constraint(), read_bw_.peak * read_bw_.scale); + } } void DiskS19::set_write_bandwidth(double value) { write_bw_.peak = value; - get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), write_bw_.peak * write_bw_.scale); - - double delta = 1.0 / value - 1.0 / (write_bw_.peak * write_bw_.scale); - update_penalties(delta); + if (get_write_constraint()) { + get_model()->get_maxmin_system()->update_constraint_bound(get_write_constraint(), write_bw_.peak * write_bw_.scale); + } } void DiskS19::set_readwrite_bandwidth(double value) { readwrite_bw_ = value; - if (get_constraint()) + if (get_constraint()) { get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), readwrite_bw_); + } } void DiskS19::apply_event(kernel::profile::Event* triggered, double value) diff --git a/src/surf/disk_s19.hpp b/src/surf/disk_s19.hpp index f169c4810d..9fe98e7521 100644 --- a/src/surf/disk_s19.hpp +++ b/src/surf/disk_s19.hpp @@ -41,8 +41,6 @@ public: ************/ class DiskS19 : public DiskImpl { - void update_penalties(double delta) const; - public: using DiskImpl::DiskImpl; void set_read_bandwidth(double value) override; diff --git a/teshsuite/s4u/CMakeLists.txt b/teshsuite/s4u/CMakeLists.txt index 2e248797bd..64c74c7b2a 100644 --- a/teshsuite/s4u/CMakeLists.txt +++ b/teshsuite/s4u/CMakeLists.txt @@ -3,7 +3,7 @@ foreach(x actor actor-autorestart actor-suspend comm-get-sender comm-pt2pt wait-all-for wait-any-for cloud-interrupt-migration cloud-two-execs concurrent_rw - host-on-off host-on-off-actors host-on-off-recv + host-on-off host-on-off-actors host-on-off-recv io-set-bw basic-link-test basic-parsing-test evaluate-get-route-time evaluate-parse-time is-router storage_client_server listen_async pid trace-integration @@ -28,7 +28,7 @@ set_property(TARGET activity-lifecycle APPEND PROPERTY INCLUDE_DIRECTORIES "${IN ## Some need to be run with all factories, some don't need tesh to run foreach(x actor actor-autorestart actor-suspend activity-lifecycle comm-get-sender wait-all-for wait-any-for - cloud-interrupt-migration cloud-two-execs concurrent_rw + cloud-interrupt-migration cloud-two-execs concurrent_rw io-set-bw vm-live-migration vm-suicide) set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh) ADD_TESH_FACTORIES(tesh-s4u-${x} "*" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x}/${x}.tesh)