2
* Copyright 2008-2011 NVIDIA Corporation
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
19
#include <thrust/iterator/iterator_traits.h>
21
#include <thrust/detail/device/cuda/scan.h>
22
#include <thrust/detail/device/omp/scan.h>
33
////////////////////////////
34
// OpenMP implementations //
35
////////////////////////////
37
template<typename InputIterator,
38
typename OutputIterator,
39
typename AssociativeOperator>
40
OutputIterator inclusive_scan(InputIterator first,
42
OutputIterator result,
43
AssociativeOperator binary_op,
44
thrust::detail::omp_device_space_tag,
45
thrust::detail::omp_device_space_tag)
47
return thrust::detail::device::omp::inclusive_scan(first, last, result, binary_op);
50
template<typename InputIterator,
51
typename OutputIterator,
53
typename AssociativeOperator>
54
OutputIterator exclusive_scan(InputIterator first,
56
OutputIterator result,
58
AssociativeOperator binary_op,
59
thrust::detail::omp_device_space_tag,
60
thrust::detail::omp_device_space_tag)
62
return thrust::detail::device::omp::exclusive_scan(first, last, result, init, binary_op);
66
//////////////////////////
67
// CUDA implementations //
68
//////////////////////////
70
template<typename InputIterator,
71
typename OutputIterator,
72
typename AssociativeOperator>
73
OutputIterator inclusive_scan(InputIterator first,
75
OutputIterator result,
76
AssociativeOperator binary_op,
77
thrust::detail::cuda_device_space_tag,
78
thrust::detail::cuda_device_space_tag)
80
return thrust::detail::device::cuda::inclusive_scan(first, last, result, binary_op);
83
template<typename InputIterator,
84
typename OutputIterator,
86
typename AssociativeOperator>
87
OutputIterator exclusive_scan(InputIterator first,
89
OutputIterator result,
91
AssociativeOperator binary_op,
92
thrust::detail::cuda_device_space_tag,
93
thrust::detail::cuda_device_space_tag)
95
return thrust::detail::device::cuda::exclusive_scan(first, last, result, init, binary_op);
98
} // end namespace dispatch
99
} // end namespace device
100
} // end namespace detail
101
} // end namespace thrust