Bolt  1.3
C++ template library with support for OpenCL
reduce.h
Go to the documentation of this file.
1 /***************************************************************************
2 * © 2012,2014 Advanced Micro Devices, Inc. All rights reserved.
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 
22 #if !defined( BOLT_AMP_REDUCE_H )
23 #define BOLT_AMP_REDUCE_H
24 #pragma once
25 
26 #include <iostream> // FIXME, remove as this is only here for debug output
27 #include <vector>
28 #include <array>
29 #include <amp.h>
30 #include <numeric>
31 #include "bolt/amp/bolt.h"
32 #include "bolt/amp/functional.h"
33 
34 namespace bolt {
35  namespace amp {
36 
92  template<typename InputIterator>
93  typename std::iterator_traits<InputIterator>::value_type
95  InputIterator first,
96  InputIterator last);
97 
98  template<typename InputIterator>
99  typename std::iterator_traits<InputIterator>::value_type
100  reduce(InputIterator first,
101  InputIterator last);
102 
103 
141  template<typename InputIterator, typename T>
142  T reduce(bolt::amp::control &ctl,
143  InputIterator first,
144  InputIterator last,
145  T init);
146 
147  template<typename InputIterator, typename T>
148  T reduce(InputIterator first,
149  InputIterator last,
150  T init);
151 
191  template<typename InputIterator, typename T, typename BinaryFunction>
192  T reduce(bolt::amp::control &ctl,
193  InputIterator first,
194  InputIterator last,
195  T init,
196  BinaryFunction binary_op=bolt::amp::plus<T>());
197 
198  template<typename InputIterator, typename T, typename BinaryFunction>
199  T reduce(InputIterator first,
200  InputIterator last,
201  T init,
202  BinaryFunction binary_op);
203 
206  };
207 };
208 
209 #include <bolt/amp/detail/reduce.inl>
210 
211 
212 #endif