SkelCL
SkelCL is a high level multi GPU skeleton library developed at the university of Münster, Germany.
 All Classes Namespaces Files Functions Variables Typedefs Groups
MapOverlap.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2011-2012 The SkelCL Team as listed in CREDITS.txt *
3  * http://skelcl.uni-muenster.de *
4  * *
5  * This file is part of SkelCL. *
6  * SkelCL is available under multiple licenses. *
7  * The different licenses are subject to terms and condition as provided *
8  * in the files specifying the license. See "LICENSE.txt" for details *
9  * *
10  *****************************************************************************
11  * *
12  * SkelCL is free software: you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation, either version 3 of the License, or *
15  * (at your option) any later version. See "LICENSE-gpl.txt" for details. *
16  * *
17  * SkelCL is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20  * GNU General Public License for more details. *
21  * *
22  *****************************************************************************
23  * *
24  * For non-commercial academic use see the license specified in the file *
25  * "LICENSE-academic.txt". *
26  * *
27  *****************************************************************************
28  * *
29  * If you are interested in other licensing models, including a commercial- *
30  * license, please contact the author at michel.steuwer@uni-muenster.de *
31  * *
32  *****************************************************************************/
33 
39 #ifndef MapOverlap_H_
40 #define MapOverlap_H_
41 
42 #include <istream>
43 #include <string>
44 
45 #include "detail/Padding.h"
46 #include "detail/Skeleton.h"
47 #include "detail/Program.h"
48 
49 namespace skelcl {
50 
53 template <typename> class Matrix;
54 template <typename> class Out;
55 
56 template <typename> class MapOverlap;
58 
69 
103 template <typename Tin, typename Tout>
104 class MapOverlap<Tout(Tin)> : public detail::Skeleton {
105 
106 public:
119  MapOverlap<Tout(Tin)>(const Source& source, unsigned int overlap_range = 1,
120  detail::Padding padding = detail::Padding::NEAREST,
121  Tin neutral_element = Tin(),
122  const std::string& func = std::string("func"));
123 
141  template <typename... Args>
142  Matrix<Tout> operator()(const Matrix<Tin>& in, Args&&... args);
143 
144 
168  template <typename... Args>
169  Matrix<Tout>& operator()(Out<Matrix<Tout>> output, const Matrix<Tin>& in,
170  Args&&... args);
171 
172 private:
173  template <typename... Args>
174  void execute(Matrix<Tout>& output, const Matrix<Tin>& in, Args&&... args);
175 
176  detail::Program createAndBuildProgram() const;
177 
178  void prepareInput(const Matrix<Tin>& in);
179 
180  void prepareOutput(Matrix<Tout>& output, const Matrix<Tin>& in);
181 
182  std::string _userSource;
183  std::string _funcName;
184  unsigned int _overlap_range;
185  detail::Padding _padding;
186  Tin _neutral_element;
187  detail::Program _program;
188 };
189 
190 } //namespace skelcl
191 
192 #include "detail/MapOverlapDef.h"
193 
194 #endif /* MAPOVERLAP_H_ */
The Matrix class is a two dimensional container which makes its data accessible on the host as well a...
Definition: Matrix.h:190
This class is a unified wrapper for defining source code in SkelCL.
Definition: Source.h:61
This class implements the MapOverlap skeleton, which describes calculations performed on one or more ...
Definition: MapOverlap.h:104