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 
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 
91  template<typename InputIterator>
92  typename std::iterator_traits<InputIterator>::value_type
94  InputIterator first,
95  InputIterator last);
96 
97  template<typename InputIterator>
98  typename std::iterator_traits<InputIterator>::value_type
99  reduce(InputIterator first,
100  InputIterator last);
101 
102 
138  template<typename InputIterator, typename T>
139  T reduce(bolt::amp::control &ctl,
140  InputIterator first,
141  InputIterator last,
142  T init);
143 
144  template<typename InputIterator, typename T>
145  T reduce(InputIterator first,
146  InputIterator last,
147  T init);
148 
186  template<typename InputIterator, typename T, typename BinaryFunction>
187  T reduce(bolt::amp::control &ctl,
188  InputIterator first,
189  InputIterator last,
190  T init,
191  BinaryFunction binary_op=bolt::amp::plus<T>());
192 
193  template<typename InputIterator, typename T, typename BinaryFunction>
194  T reduce(InputIterator first,
195  InputIterator last,
196  T init,
197  BinaryFunction binary_op);
198 
201  };
202 };
203 
204 #include <bolt/amp/detail/reduce.inl>
205 
206 
207 #endif