~ubuntu-branches/ubuntu/trusty/libthrust/trusty

« back to all changes in this revision

Viewing changes to detail/device/dispatch/scan.h

  • Committer: Package Import Robot
  • Author(s): Andreas Beckmann
  • Date: 2011-12-02 01:48:24 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20111202014824-bpfczhbx39usefge
Tags: 1.5.0-1
* New upstream release.
* debian/copyright:
  - Update to dep5.mdwn?revision=202.
  - Update copyright entries for added/moved files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright 2008-2011 NVIDIA Corporation
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
 
#pragma once
18
 
 
19
 
#include <thrust/iterator/iterator_traits.h>
20
 
 
21
 
#include <thrust/detail/device/cuda/scan.h>
22
 
#include <thrust/detail/device/omp/scan.h>
23
 
 
24
 
namespace thrust
25
 
{
26
 
namespace detail
27
 
{
28
 
namespace device
29
 
{
30
 
namespace dispatch
31
 
{
32
 
 
33
 
////////////////////////////
34
 
// OpenMP implementations //
35
 
////////////////////////////
36
 
 
37
 
template<typename InputIterator,
38
 
         typename OutputIterator,
39
 
         typename AssociativeOperator>
40
 
  OutputIterator inclusive_scan(InputIterator first,
41
 
                                InputIterator last,
42
 
                                OutputIterator result,
43
 
                                AssociativeOperator binary_op,
44
 
                                thrust::detail::omp_device_space_tag,
45
 
                                thrust::detail::omp_device_space_tag)
46
 
{
47
 
    return thrust::detail::device::omp::inclusive_scan(first, last, result, binary_op);
48
 
}
49
 
 
50
 
template<typename InputIterator,
51
 
         typename OutputIterator,
52
 
         typename T,
53
 
         typename AssociativeOperator>
54
 
  OutputIterator exclusive_scan(InputIterator first,
55
 
                                InputIterator last,
56
 
                                OutputIterator result,
57
 
                                T init,
58
 
                                AssociativeOperator binary_op,
59
 
                                thrust::detail::omp_device_space_tag,
60
 
                                thrust::detail::omp_device_space_tag)
61
 
{
62
 
    return thrust::detail::device::omp::exclusive_scan(first, last, result, init, binary_op);
63
 
}
64
 
 
65
 
 
66
 
//////////////////////////
67
 
// CUDA implementations //
68
 
//////////////////////////
69
 
 
70
 
template<typename InputIterator,
71
 
         typename OutputIterator,
72
 
         typename AssociativeOperator>
73
 
  OutputIterator inclusive_scan(InputIterator first,
74
 
                                InputIterator last,
75
 
                                OutputIterator result,
76
 
                                AssociativeOperator binary_op,
77
 
                                thrust::detail::cuda_device_space_tag,
78
 
                                thrust::detail::cuda_device_space_tag)
79
 
{
80
 
    return thrust::detail::device::cuda::inclusive_scan(first, last, result, binary_op);
81
 
}
82
 
 
83
 
template<typename InputIterator,
84
 
         typename OutputIterator,
85
 
         typename T,
86
 
         typename AssociativeOperator>
87
 
  OutputIterator exclusive_scan(InputIterator first,
88
 
                                InputIterator last,
89
 
                                OutputIterator result,
90
 
                                T init,
91
 
                                AssociativeOperator binary_op,
92
 
                                thrust::detail::cuda_device_space_tag,
93
 
                                thrust::detail::cuda_device_space_tag)
94
 
{
95
 
    return thrust::detail::device::cuda::exclusive_scan(first, last, result, init, binary_op);
96
 
}
97
 
 
98
 
} // end namespace dispatch
99
 
} // end namespace device
100
 
} // end namespace detail
101
 
} // end namespace thrust
102