Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify the way I/O actions are created (CPU style)
authorFred Suter <suterf@ornl.gov>
Wed, 19 Oct 2022 16:20:10 +0000 (12:20 -0400)
committerFred Suter <suterf@ornl.gov>
Fri, 28 Oct 2022 11:39:36 +0000 (07:39 -0400)
src/kernel/activity/IoImpl.cpp
src/kernel/resource/DiskImpl.hpp
src/surf/disk_s19.cpp
src/surf/disk_s19.hpp

index c30b1a9..8f18e6d 100644 (file)
@@ -72,8 +72,7 @@ IoImpl& IoImpl::set_disk(resource::DiskImpl* disk)
 IoImpl* IoImpl::start()
 {
   set_state(State::RUNNING);
-  surf_action_ =
-      disk_->get_host()->get_netpoint()->get_englobing_zone()->get_disk_model()->io_start(disk_, size_, type_);
+  surf_action_ = disk_->io_start(size_, type_);
   surf_action_->set_sharing_penalty(sharing_penalty_);
   surf_action_->set_activity(this);
   set_start_time(surf_action_->get_start_time());
index 611234d..1c4d1ce 100644 (file)
@@ -37,8 +37,6 @@ public:
   DiskModel& operator=(const DiskModel&) = delete;
 
   virtual DiskImpl* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth) = 0;
-
-  virtual DiskAction* io_start(const DiskImpl* disk, sg_size_t size, s4u::Io::OpType type) = 0;
 };
 
 /************
@@ -111,6 +109,8 @@ public:
 
   void seal() override;
   void destroy(); // Must be called instead of the destructor
+
+  virtual DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) = 0;
 };
 
 /**********
index b0471f3..e1b2bb0 100644 (file)
@@ -49,21 +49,21 @@ void DiskS19Model::update_actions_state(double /*now*/, double delta)
   }
 }
 
-DiskAction* DiskS19Model::io_start(const DiskImpl* disk, sg_size_t size, s4u::Io::OpType type)
+DiskAction* DiskS19::io_start(sg_size_t size, s4u::Io::OpType type)
 {
-  auto* action = new DiskS19Action(this, static_cast<double>(size), not disk->is_on());
-  get_maxmin_system()->expand(disk->get_constraint(), action->get_variable(), 1.0);
+  auto* action = new DiskS19Action(get_model(), static_cast<double>(size), not is_on());
+  get_model()->get_maxmin_system()->expand(get_constraint(), action->get_variable(), 1.0);
   switch (type) {
     case s4u::Io::OpType::READ:
-      get_maxmin_system()->expand(disk->get_read_constraint(), action->get_variable(), 1.0);
+      get_model()->get_maxmin_system()->expand(get_read_constraint(), action->get_variable(), 1.0);
       break;
     case s4u::Io::OpType::WRITE:
-      get_maxmin_system()->expand(disk->get_write_constraint(), action->get_variable(), 1.0);
+      get_model()->get_maxmin_system()->expand(get_write_constraint(), action->get_variable(), 1.0);
       break;
     default:
       THROW_UNIMPLEMENTED;
   }
-  if (const auto& factor_cb = disk->get_factor_cb()) { // handling disk variability
+  if (const auto& factor_cb = get_factor_cb()) { // handling disk variability
     action->set_rate_factor(factor_cb(size, type));
   }
   return action;
index a6413dd..478b188 100644 (file)
@@ -29,8 +29,6 @@ public:
   using DiskModel::DiskModel;
   DiskImpl* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth) override;
 
-  DiskAction* io_start(const DiskImpl* disk, sg_size_t size, s4u::Io::OpType type) override;
-
   void update_actions_state(double now, double delta) override;
 };
 
@@ -45,6 +43,7 @@ public:
   void set_write_bandwidth(double value) override;
   void set_readwrite_bandwidth(double value) override;
   void apply_event(kernel::profile::Event* triggered, double value) override;
+  DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) override;
 };
 
 /**********