• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10 
11 #ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_HPP
12 #define BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_HPP
13 
14 #include <boost/compute/device.hpp>
15 #include <boost/compute/algorithm/detail/scan_on_cpu.hpp>
16 #include <boost/compute/algorithm/detail/scan_on_gpu.hpp>
17 
18 namespace boost {
19 namespace compute {
20 namespace detail {
21 
22 template<class InputIterator, class OutputIterator, class T, class BinaryOperator>
scan(InputIterator first,InputIterator last,OutputIterator result,bool exclusive,T init,BinaryOperator op,command_queue & queue)23 inline OutputIterator scan(InputIterator first,
24                            InputIterator last,
25                            OutputIterator result,
26                            bool exclusive,
27                            T init,
28                            BinaryOperator op,
29                            command_queue &queue)
30 {
31     const device &device = queue.get_device();
32 
33     if(device.type() & device::cpu){
34         return scan_on_cpu(first, last, result, exclusive, init, op, queue);
35     }
36     else {
37         return scan_on_gpu(first, last, result, exclusive, init, op, queue);
38     }
39 }
40 
41 } // end detail namespace
42 } // end compute namespace
43 } // end boost namespace
44 
45 #endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_HPP
46