ASL  0.1.7
Advanced Simulation Library
aclKernelMerger.h
Go to the documentation of this file.
1 /*
2  * Advanced Simulation Library <http://asl.org.il>
3  *
4  * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5  *
6  *
7  * This file is part of Advanced Simulation Library (ASL).
8  *
9  * ASL is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU Affero General Public License as
11  * published by the Free Software Foundation, version 3 of the License.
12  *
13  * ASL is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Affero General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 
24 #ifndef ACLKERNELMERGER_H
25 #define ACLKERNELMERGER_H
26 
27 #include <memory>
28 #include <vector>
29 
30 namespace acl
31 {
32  class ElementBase;
33  typedef std::shared_ptr<ElementBase> Element;
34  class Kernel;
35  typedef std::shared_ptr<Kernel> SPKernel;
36 
38 
46  {
47  private:
48  std::vector<SPKernel> kernels;
49  SPKernel kernel;
50  unsigned int size;
51  std::vector<unsigned int> offsets;
52 
53  unsigned int getKernelSize(unsigned int i);
54  void checkKernelsCompatibility();
55  void computeOffsets();
56  Element castSpliter(unsigned int i1, unsigned int i2);
57  public:
58  KernelMerger();
59  void setup();
60  void compute();
61  std::string getKernelSource();
63  void clear();
64  void addKernel(SPKernel k);
65  void addKernel(const KernelMerger & km);
66  unsigned int getSize();
67  };
68 
70  typedef std::shared_ptr<KernelMerger> SPKernelMerger;
71 
72 
73 
74 } // namespace acl
75 
76 #endif // ACLKERNELMERGER_H
Advanced Computational Language.
Definition: acl.h:40
void addKernel(SPKernel k)
std::shared_ptr< Kernel > SPKernel
std::shared_ptr< KernelMerger > SPKernelMerger
OpenCl Kernel merger.
void clear()
removes all kernels
OpenCl Kernel generator.
Definition: aclKernel.h:48
std::shared_ptr< ElementBase > Element
Definition: acl.h:49
std::string getKernelSource()
unsigned int getSize()