Line data Source code
1 : /*! 2 : * \file 3 : * \brief Class sched::Scheduler. 4 : */ 5 : #ifndef SCHEDULER_HPP__ 6 : #define SCHEDULER_HPP__ 7 : 8 : #include "Runtime/Pipeline/Pipeline.hpp" 9 : #include "Runtime/Sequence/Sequence.hpp" 10 : #include "Tools/Interface/Interface_reset.hpp" 11 : #include <chrono> 12 : #include <iostream> 13 : #include <string> 14 : #include <utility> 15 : #include <vector> 16 : 17 : namespace spu 18 : { 19 : namespace sched 20 : { 21 : struct task_desc_t 22 : { 23 : runtime::Task* tptr; 24 : std::vector<std::chrono::duration<double, std::nano>> exec_duration; 25 : }; 26 : class Scheduler : public tools::Interface_reset 27 : { 28 : private: 29 : runtime::Sequence* sequence; 30 : 31 : protected: 32 : std::vector<task_desc_t> tasks_desc; 33 : std::vector<size_t> profiled_puids; 34 : std::vector<std::string> profiling_summary; 35 : std::vector<std::pair<size_t, size_t>> solution; 36 : 37 : Scheduler(runtime::Sequence& sequence); 38 : Scheduler(runtime::Sequence* sequence); 39 : 40 : void _profile(const int puid, const size_t n_exec); 41 : 42 : public: 43 : void profile(const size_t n_exec = 100); 44 : void profile(const std::vector<size_t>& puids, const size_t n_exec = 100); 45 : void print_profiling(std::ostream& stream = std::cout); 46 : const std::vector<task_desc_t>& get_profiling(); 47 11 : virtual ~Scheduler() = default; 48 : runtime::Pipeline* generate_pipeline(); 49 : std::vector<std::pair<size_t, size_t>> get_solution(); 50 : virtual void reset() override; 51 : virtual void schedule() = 0; 52 : runtime::Pipeline* instantiate_pipeline(const std::vector<size_t> synchro_buffer_sizes, 53 : const std::vector<bool> synchro_active_waitings, 54 : const std::vector<bool> thread_pinings, 55 : const std::string& pinning_policy); 56 : runtime::Pipeline* instantiate_pipeline(const size_t buffer_size = 1, 57 : const bool active_wait = false, 58 : const bool thread_pining = false, 59 : const std::string& pinning_policy = ""); 60 : virtual std::vector<bool> get_thread_pinnings() const; 61 : virtual std::vector<size_t> get_sync_buff_sizes() const; 62 : virtual std::vector<bool> get_sync_active_waitings() const; 63 : virtual std::string get_threads_mapping() const; 64 : size_t get_n_alloc_ressources() const; 65 : virtual double get_throughput_est() const; // return the estimated number of streams per second 66 : }; 67 : } // namespace sched 68 : } // namespace spu 69 : 70 : #endif // SCHEDULER_HPP__