pelib  2.0.0
include/pelib/Schedule.hpp
Go to the documentation of this file.
00001 /*
00002  Copyright 2015 Nicolas Melot
00003 
00004  This file is part of Pelib.
00005 
00006  Pelib is free software: you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation, either version 3 of the License, or
00009  (at your option) any later version.
00010 
00011  Pelib is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with Pelib. If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 
00021 #include <set>
00022 
00023 #include <pelib/Algebra.hpp>
00024 #include <pelib/Link.hpp>
00025 #include <pelib/Task.hpp>
00026 #include <pelib/Taskgraph.hpp>
00027 #include <pelib/Platform.hpp>
00028 
00029 #ifndef PELIB_SCHEDULE
00030 #define PELIB_SCHEDULE
00031 
00032 namespace pelib
00033 {       
00035         class Schedule : public Record
00036         {
00037                 public:
00039                         typedef std::pair<const Task*, double> work;
00041                         typedef std::map<float, work> sequence;
00043                         typedef std::map<int, sequence> table;
00044 
00050                         Schedule(const std::string &name, const std::string &appName, const table &schedule);
00054                         Schedule(const std::string &name, const Algebra &algebra);
00058                         Schedule(const std::string &name, const std::string &appName, const Algebra &algebra);
00059                         Schedule(const Schedule& src);
00060 
00062                         virtual ~Schedule();
00064                         virtual Schedule* clone() const;
00065 
00067                         virtual Algebra buildAlgebra() const;
00068 
00070                         virtual std::string
00071                         getName() const;
00072 
00074                         virtual std::string
00075                         getAppName() const;
00076 
00078                         virtual const table&
00079                         getSchedule() const;
00080 
00082                         virtual const set<Task>&
00083                         getTasks() const;
00084 
00086                         virtual Schedule&
00087                         operator=(const Schedule &);
00088 
00092                         virtual const set<const Task*>&
00093                         getTasks(int core) const;
00094 
00098                         virtual const Task&
00099                         getTask(int id) const;
00100 
00101                         multiset<const Task*> getRemoteProducers(int core, const Taskgraph &tg, const Platform &pt) const;
00102                         multiset<const Task*> getRemoteConsumers(int core, const Taskgraph &tg, const Platform &pt) const;
00103                         multiset<const Task*> getRemoteTaskProducers(const Task&, const Taskgraph &tg, const Platform &pt) const;
00104                         multiset<const Task*> getRemoteTaskConsumers(const Task&, const Taskgraph &tg, const Platform &pt) const;
00105                         
00106                         multiset<const Link*> getRemoteProducersLink(int core, const Taskgraph &tg, const Platform &pt) const;
00107                         multiset<const Link*> getRemoteConsumersLink(int core, const Taskgraph &tg, const Platform &pt) const;
00108                         multimap<const Task*, const Link*> getRemoteProducersTaskLink(int core, const Taskgraph &tg, const Platform &pt) const;
00109                         multimap<const Task*, const Link*> getRemoteConsumersTaskLink(int core, const Taskgraph &tg, const Platform &pt) const;
00114                         virtual set<const Task*>
00115                         getTasksSharedMemoryIsland(const set<int>& islands, const Platform &pt) const;
00116 
00122                         virtual multiset<const Task*>
00123                         getRemoteSharedMemoryIslandProducers(const set<int> &islands, const Taskgraph &tg, const Platform &pt) const;
00124 
00130                         virtual multiset<const Task*>
00131                         getRemoteSharedMemoryIslandTaskProducers(const Task &t, const Taskgraph &tg, const Platform &pt) const;
00132 
00138                         virtual multiset<const Task*>
00139                         getRemoteSharedMemoryIslandConsumers(const set<int> &islands, const Taskgraph &tg, const Platform &pt) const;
00140 
00146                         virtual multiset<const Task*>
00147                         getRemoteSharedMemoryIslandTaskConsumers(const Task &t, const Taskgraph &tg, const Platform &pt) const;
00148 
00152                         virtual const set<int>
00153                         getCores(const Task &t) const;
00154 
00160                         static
00161                         Algebra
00162                         addStartTime(const Algebra &data, const Taskgraph &tg, const Platform &platform);
00163 
00164                 protected:
00165                         std::string name, appName;
00166                         table schedule;
00167                         set<Task> tasks;
00168                         std::map<int, set<const Task*> > core_tasks;
00169 
00172                         virtual void
00173                         setSchedule(const table&);
00174                 private:
00175                         void buildFromAlgebra(const string &name, const string &appName, const Algebra &data);
00176         };
00177 }
00178 
00179 #endif