Line data Source code
1 : #include <cmath> 2 : #include <iostream> 3 : #include <limits> 4 : #include <sstream> 5 : 6 : #include "Scheduler/GR/Scheduler_GR.hpp" 7 : #include "Tools/Exception/exception.hpp" 8 : 9 : using namespace spu; 10 : using namespace spu::sched; 11 : 12 0 : Scheduler_GR::Scheduler_GR(runtime::Sequence& sequence, const size_t R) 13 : : Scheduler(&sequence) 14 0 : , R(R) 15 : { 16 0 : } 17 : 18 0 : Scheduler_GR::Scheduler_GR(runtime::Sequence* sequence, const size_t R) 19 : : Scheduler(sequence) 20 0 : , R(R) 21 : { 22 0 : } 23 : 24 : void 25 0 : Scheduler_GR::schedule() 26 : { 27 0 : if (this->tasks_desc.empty()) 28 : { 29 0 : std::stringstream message; 30 0 : message << "'tasks_desc' cannot be empty, you need to execute the 'Scheduler::profile()' method first!"; 31 0 : throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str()); 32 0 : } 33 : 34 0 : if (!this->solution.empty()) this->solution.clear(); 35 0 : for (size_t t = 0; t < this->tasks_desc.size(); t++) 36 : { 37 0 : size_t cur_R = 1; 38 0 : if (tasks_desc[t].tptr->is_replicable()) cur_R = this->R; 39 0 : this->solution.push_back({ 1, cur_R }); 40 : } 41 0 : }