Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix set_read_bandwidth and set_write_bandwidth for disks
authorBruno Donassolo <bruno.donassolo@inria.fr>
Tue, 27 Jul 2021 18:53:35 +0000 (20:53 +0200)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Fri, 30 Jul 2021 12:54:11 +0000 (14:54 +0200)
- 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

MANIFEST.in
src/kernel/lmm/maxmin.cpp
src/kernel/resource/DiskImpl.hpp
src/surf/disk_s19.cpp
src/surf/disk_s19.hpp
teshsuite/s4u/CMakeLists.txt

index fcc89b0..6eee929 100644 (file)
@@ -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
index 1586f5e..80d0519 100644 (file)
@@ -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;
 
index 8cd0ca7..0351e1d 100644 (file)
@@ -120,8 +120,6 @@ public:
 
   using Action::Action;
   void set_state(simgrid::kernel::resource::Action::State state) override;
-
-  double sharing_penalty_ = {};
 };
 
 } // namespace resource
index 6c2e68a..86028da 100644 (file)
@@ -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<DiskS19Action*>(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)
index f169c48..9fe98e7 100644 (file)
@@ -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;
index 2e24879..64c74c7 100644 (file)
@@ -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)