/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipcub/checkouts/docs-5.0.0/hipcub/include/hipcub/backend/cub/device/device_scan.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipcub/checkouts/docs-5.0.0/hipcub/include/hipcub/backend/cub/device/device_scan.hpp Source File#

hipCUB: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipcub/checkouts/docs-5.0.0/hipcub/include/hipcub/backend/cub/device/device_scan.hpp Source File
device_scan.hpp
1 /******************************************************************************
2  * Copyright (c) 2010-2011, Duane Merrill. All rights reserved.
3  * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
4  * Modifications Copyright (c) 2017-2020, Advanced Micro Devices, Inc. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the NVIDIA CORPORATION nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  ******************************************************************************/
29 
30 #ifndef HIPCUB_CUB_DEVICE_DEVICE_SCAN_HPP_
31 #define HIPCUB_CUB_DEVICE_DEVICE_SCAN_HPP_
32 
33 #include "../../../config.hpp"
34 
35 #include <cub/device/device_scan.cuh>
36 
37 BEGIN_HIPCUB_NAMESPACE
38 
40 {
41 public:
42  template <
43  typename InputIteratorT,
44  typename OutputIteratorT
45  >
46  HIPCUB_RUNTIME_FUNCTION static
47  hipError_t InclusiveSum(void *d_temp_storage,
48  size_t &temp_storage_bytes,
49  InputIteratorT d_in,
50  OutputIteratorT d_out,
51  int num_items,
52  hipStream_t stream = 0,
53  bool debug_synchronous = false)
54  {
55  return hipCUDAErrorTohipError(
56  ::cub::DeviceScan::InclusiveSum(
57  d_temp_storage, temp_storage_bytes,
58  d_in, d_out, num_items,
59  stream, debug_synchronous
60  )
61  );
62  }
63 
64  template <
65  typename InputIteratorT,
66  typename OutputIteratorT,
67  typename ScanOpT
68  >
69  HIPCUB_RUNTIME_FUNCTION static
70  hipError_t InclusiveScan(void *d_temp_storage,
71  size_t &temp_storage_bytes,
72  InputIteratorT d_in,
73  OutputIteratorT d_out,
74  ScanOpT scan_op,
75  int num_items,
76  hipStream_t stream = 0,
77  bool debug_synchronous = false)
78  {
79  return hipCUDAErrorTohipError(
80  ::cub::DeviceScan::InclusiveScan(
81  d_temp_storage, temp_storage_bytes,
82  d_in, d_out, scan_op, num_items,
83  stream, debug_synchronous
84  )
85  );
86  }
87 
88  template <
89  typename InputIteratorT,
90  typename OutputIteratorT
91  >
92  HIPCUB_RUNTIME_FUNCTION static
93  hipError_t ExclusiveSum(void *d_temp_storage,
94  size_t &temp_storage_bytes,
95  InputIteratorT d_in,
96  OutputIteratorT d_out,
97  int num_items,
98  hipStream_t stream = 0,
99  bool debug_synchronous = false)
100  {
101  return hipCUDAErrorTohipError(
102  ::cub::DeviceScan::ExclusiveSum(
103  d_temp_storage, temp_storage_bytes,
104  d_in, d_out, num_items,
105  stream, debug_synchronous
106  )
107  );
108  }
109 
110  template <
111  typename InputIteratorT,
112  typename OutputIteratorT,
113  typename ScanOpT,
114  typename InitValueT
115  >
116  HIPCUB_RUNTIME_FUNCTION static
117  hipError_t ExclusiveScan(void *d_temp_storage,
118  size_t &temp_storage_bytes,
119  InputIteratorT d_in,
120  OutputIteratorT d_out,
121  ScanOpT scan_op,
122  InitValueT init_value,
123  int num_items,
124  hipStream_t stream = 0,
125  bool debug_synchronous = false)
126  {
127  return hipCUDAErrorTohipError(
128  ::cub::DeviceScan::ExclusiveScan(
129  d_temp_storage, temp_storage_bytes,
130  d_in, d_out, scan_op, init_value, num_items,
131  stream, debug_synchronous
132  )
133  );
134  }
135 };
136 
137 END_HIPCUB_NAMESPACE
138 
139 #endif // HIPCUB_CUB_DEVICE_DEVICE_SCAN_HPP_
Definition: device_scan.hpp:40