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
AllPairs.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 
40 
41 #ifndef ALLPAIRS_H
42 #define ALLPAIRS_H
43 
44 #include <istream>
45 #include <string>
46 
47 #include "detail/Skeleton.h"
48 #include "detail/Program.h"
49 
50 namespace skelcl {
51 
54 template <typename> class Matrix;
55 template <typename> class Reduce;
56 template <typename> class Zip;
57 template <typename> class Out;
58 
59 template<typename> class AllPairs;
61 
71 
115 template<typename Tleft,
116  typename Tright,
117  typename Tout>
118 class AllPairs<Tout(Tleft, Tright)> : public detail::Skeleton {
119 public:
127  AllPairs<Tout(Tleft, Tright)>(const Reduce<Tout(Tout)>& reduce,
128  const Zip<Tout(Tleft, Tright)>& zip);
129 
138  AllPairs<Tout(Tleft, Tright)>(const std::string& source,
139  const std::string& func = std::string("func"));
140 
175  template <typename... Args>
176  Matrix<Tout> operator()(const Matrix<Tleft>& left,
177  const Matrix<Tright>& right, Args&&... args);
178 
216  //
221  template <typename... Args>
222  Matrix<Tout>& operator()(Out< Matrix<Tout> > output,
223  const Matrix<Tleft>& left,
224  const Matrix<Tright>& right,
225  Args&&... args);
226 
227 private:
228  template <typename... Args>
229  void execute(Matrix<Tout>& output, const Matrix<Tleft>& left,
230  const Matrix<Tright>& right, Args&&... args);
231 
232  detail::Program createAndBuildProgramSpecial() const;
233 
234  detail::Program createAndBuildProgramGeneral() const;
235 
236  void prepareInput(const Matrix<Tleft>& left, const Matrix<Tright>& right);
237 
238  void prepareOutput(Matrix<Tout>& output, const Matrix<Tleft>& left,
239  const Matrix<Tright>& right);
240 
241  // used by special implementation
242  std::string _srcReduce;
243  std::string _srcZip;
244  std::string _funcReduce;
245  std::string _funcZip;
246  std::string _idReduce;
247 
248  // used by general implementation
249  std::string _srcUser;
250  std::string _funcUser;
251 
252  // used by both implementations
253  unsigned int _C;
254  unsigned int _R;
255  unsigned int _S;
256  detail::Program _program;
257 };
258 
259 } // namespace skelcl
260 
261 #include "detail/AllPairsDef.h"
262 
263 #endif // ALLPAIRS_H
The Matrix class is a two dimensional container which makes its data accessible on the host as well a...
Definition: Matrix.h:190
An instance of the AllPairs class describes a calculation of pairs of row vectors and column vectors ...
Definition: AllPairs.h:118
An instance of the Zip class describes a calculation which can be performed on one or more devices...
Definition: Zip.h:99