Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Specialize return types.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 14 May 2019 09:43:21 +0000 (11:43 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 14 May 2019 15:17:02 +0000 (17:17 +0200)
src/surf/StorageImpl.hpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp

index da13a3c..1e38c51 100644 (file)
@@ -82,7 +82,7 @@ public:
   void turn_off() override;
 
   void destroy(); // Must be called instead of the destructor
-  virtual Action* io_start(sg_size_t size, s4u::Io::OpType type) = 0;
+  virtual StorageAction* io_start(sg_size_t size, s4u::Io::OpType type) = 0;
   /**
    * @brief Read a file
    *
index 4b273c7..a011ad3 100644 (file)
@@ -48,6 +48,8 @@ public:
  * Resource *
  ************/
 
+class CpuAction;
+
 /** @ingroup SURF_cpu_interface
 * @brief SURF cpu resource interface class
 * @details A Cpu represent a cpu associated to a host
@@ -90,7 +92,7 @@ public:
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    */
-  virtual Action* execution_start(double size) = 0;
+  virtual CpuAction* execution_start(double size) = 0;
 
   /**
    * @brief Execute some quantity of computation on more than one core
@@ -99,7 +101,7 @@ public:
    * @param requested_cores The desired amount of cores. Must be >= 1
    * @return The CpuAction corresponding to the processing
    */
-  virtual Action* execution_start(double size, int requested_cores) = 0;
+  virtual CpuAction* execution_start(double size, int requested_cores) = 0;
 
   /**
    * @brief Make a process sleep for duration (in seconds)
@@ -107,7 +109,7 @@ public:
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    */
-  virtual Action* sleep(double duration) = 0;
+  virtual CpuAction* sleep(double duration) = 0;
 
   /** @brief Get the amount of cores */
   virtual int get_core_count();
index 2bcdfab..f304375 100644 (file)
@@ -112,7 +112,7 @@ public:
 
   bool is_used() override;
   CpuAction* execution_start(double size) override;
-  Action* execution_start(double, int) override
+  CpuAction* execution_start(double, int) override
   {
     THROW_UNIMPLEMENTED;
     return nullptr;
index 19e985e..384656c 100644 (file)
@@ -131,9 +131,9 @@ void HostL07Model::update_actions_state(double /*now*/, double delta)
   }
 }
 
-kernel::resource::Action* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list,
-                                                         const double* flops_amount, const double* bytes_amount,
-                                                         double rate)
+kernel::resource::CpuAction* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list,
+                                                            const double* flops_amount, const double* bytes_amount,
+                                                            double rate)
 {
   return new L07Action(this, host_list, flops_amount, bytes_amount, rate);
 }
@@ -254,20 +254,20 @@ LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwid
   s4u::Link::on_creation(this->piface_);
 }
 
-kernel::resource::Action* CpuL07::execution_start(double size)
+kernel::resource::CpuAction* CpuL07::execution_start(double size)
 {
   std::vector<s4u::Host*> host_list = {get_host()};
 
   double* flops_amount = new double[host_list.size()]();
   flops_amount[0] = size;
 
-  kernel::resource::Action* res =
+  kernel::resource::CpuAction* res =
       static_cast<CpuL07Model*>(get_model())->hostModel_->execute_parallel(host_list, flops_amount, nullptr, -1);
   static_cast<L07Action*>(res)->free_arrays_ = true;
   return res;
 }
 
-kernel::resource::Action* CpuL07::sleep(double duration)
+kernel::resource::CpuAction* CpuL07::sleep(double duration)
 {
   L07Action *action = static_cast<L07Action*>(execution_start(1.0));
   action->set_max_duration(duration);
index 568618a..523e00f 100644 (file)
@@ -42,8 +42,8 @@ public:
 
   double next_occuring_event(double now) override;
   void update_actions_state(double now, double delta) override;
-  kernel::resource::Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
-                                             const double* bytes_amount, double rate) override;
+  kernel::resource::CpuAction* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                                                const double* bytes_amount, double rate) override;
 };
 
 class CpuL07Model : public kernel::resource::CpuModel {
@@ -83,13 +83,13 @@ public:
   ~CpuL07() override;
   bool is_used() override;
   void apply_event(kernel::profile::Event* event, double value) override;
-  kernel::resource::Action* execution_start(double size) override;
-  kernel::resource::Action* execution_start(double, int) override
+  kernel::resource::CpuAction* execution_start(double size) override;
+  kernel::resource::CpuAction* execution_start(double, int) override
   {
     THROW_UNIMPLEMENTED;
     return nullptr;
   }
-  kernel::resource::Action* sleep(double duration) override;
+  kernel::resource::CpuAction* sleep(double duration) override;
 
 protected:
   void on_speed_change() override;
@@ -112,10 +112,10 @@ public:
  * Action *
  **********/
 class L07Action : public kernel::resource::CpuAction {
-  friend Action *CpuL07::execution_start(double size);
-  friend Action *CpuL07::sleep(double duration);
-  friend Action* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
-                                                const double* bytes_amount, double rate);
+  friend CpuAction* CpuL07::execution_start(double size);
+  friend CpuAction* CpuL07::sleep(double duration);
+  friend CpuAction* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                                                   const double* bytes_amount, double rate);
   friend Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate);
 
 public: