Line data Source code
1 : /*! 2 : * \file 3 : * \brief Class sched::Scheduler_OTAC. 4 : */ 5 : #ifndef SCHEDULER_OTAC_HPP__ 6 : #define SCHEDULER_OTAC_HPP__ 7 : 8 : #include "Scheduler/Scheduler.hpp" 9 : #include <thread> 10 : 11 : namespace spu 12 : { 13 : namespace sched 14 : { 15 : 16 : class Scheduler_OTAC : public Scheduler 17 : { 18 : protected: 19 : const size_t R; /**< The maximum number of resources allowed to perform the scheduling. */ 20 : double P; /**< The period or the reciprocal throughput of the pipeline. */ 21 : 22 : public: 23 : Scheduler_OTAC(runtime::Sequence& sequence, const size_t R = std::thread::hardware_concurrency()); 24 : Scheduler_OTAC(runtime::Sequence* sequence, const size_t R = std::thread::hardware_concurrency()); 25 22 : ~Scheduler_OTAC() = default; 26 : virtual void schedule() override; 27 : double get_period() const; 28 : virtual void reset() override; 29 : virtual double get_throughput_est() const override; 30 : 31 : private: 32 : /** 33 : * Find a solution. 34 : * @param chain An input vector of tasks descriptor with profiled time. 35 : * @param R The input number of resources available. 36 : * @param P The output periodicity (reciprocal of pipeline throughput). 37 : * @param solution The output solution in the form of a vector of (n,r) pairs. 38 : */ 39 : void SOLVE(const std::vector<task_desc_t>& chain, 40 : const size_t R, 41 : double& P, 42 : std::vector<std::pair<size_t, size_t>>& solution); 43 : 44 : /** 45 : * Compute a solution or determine if there is no solution. 46 : * @param chain An input vector of tasks descriptor with profiled time. 47 : * @param R The input number of available resources. 48 : * @param P The input periodicity (reciprocal of pipeline throughput), this parameter can be updated to a new 49 : * periodicity value. 50 : * @param solution The output solution in the form of a vector of (n,r) pairs. 51 : * @return A boolean depending if there is a solution or not. 52 : */ 53 : bool PROBE(const std::vector<task_desc_t>& chain, 54 : const size_t R, 55 : double& P, 56 : std::vector<std::pair<size_t, size_t>>& solution); 57 : }; 58 : } // namespace sched 59 : } // namespace spu 60 : 61 : #endif // SCHEDULER_OTAC_HPP__