Bolt  1.1
C++ template library with support for OpenCL
reduce.h
Go to the documentation of this file.
1 /***************************************************************************
2 * Copyright 2012 - 2013 Advanced Micro Devices, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 
16 ***************************************************************************/
17 
18 #if !defined( BOLT_CL_REDUCE_H )
19 #define BOLT_CL_REDUCE_H
20 #pragma once
21 
22 #include <bolt/cl/bolt.h>
23 #include <bolt/cl/functional.h>
24 #include <bolt/cl/device_vector.h>
25 
26 #include <string>
27 #include <iostream>
28 
35 namespace bolt {
36  namespace cl {
37 
89  template<typename InputIterator>
90  typename std::iterator_traits<InputIterator>::value_type
92  InputIterator first,
93  InputIterator last,
94  const std::string& cl_code="");
95 
96  template<typename InputIterator>
97  typename std::iterator_traits<InputIterator>::value_type
98  reduce(InputIterator first,
99  InputIterator last,
100  const std::string& cl_code="");
101 
102 
140  template<typename InputIterator, typename T>
141  T reduce(bolt::cl::control &ctl,
142  InputIterator first,
143  InputIterator last,
144  T init,
145  const std::string& cl_code="");
146 
147  template<typename InputIterator, typename T>
148  T reduce(InputIterator first,
149  InputIterator last,
150  T init,
151  const std::string& cl_code="");
152 
189  template<typename InputIterator, typename T, typename BinaryFunction>
190  T reduce(bolt::cl::control &ctl,
191  InputIterator first,
192  InputIterator last,
193  T init,
194  BinaryFunction binary_op=bolt::cl::plus<T>(),
195  const std::string& cl_code="") ;
196 
197  template<typename InputIterator, typename T, typename BinaryFunction>
198  T reduce(InputIterator first,
199  InputIterator last,
200  T init,
201  BinaryFunction binary_op,
202  const std::string& cl_code="") ;
203 
206  };
207 };
208 
209 #include <bolt/cl/detail/reduce.inl>
210 #endif