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

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

hipCUB: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipcub/checkouts/docs-5.6.0/hipcub/include/hipcub/backend/cub/device/device_histogram.hpp Source File
device_histogram.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_HISTOGRAM_HPP_
31 #define HIPCUB_CUB_DEVICE_DEVICE_HISTOGRAM_HPP_
32 
33 #include "../../../config.hpp"
34 
35 #include <cub/device/device_histogram.cuh>
36 
37 BEGIN_HIPCUB_NAMESPACE
38 
40 {
41  template<
42  typename SampleIteratorT,
43  typename CounterT,
44  typename LevelT,
45  typename OffsetT
46  >
47  HIPCUB_RUNTIME_FUNCTION static
48  hipError_t HistogramEven(void * d_temp_storage,
49  size_t& temp_storage_bytes,
50  SampleIteratorT d_samples,
51  CounterT * d_histogram,
52  int num_levels,
53  LevelT lower_level,
54  LevelT upper_level,
55  OffsetT num_samples,
56  hipStream_t stream = 0,
57  bool debug_synchronous = false)
58  {
59  return hipCUDAErrorTohipError(
60  ::cub::DeviceHistogram::HistogramEven(
61  d_temp_storage, temp_storage_bytes,
62  d_samples,
63  d_histogram,
64  num_levels, lower_level, upper_level,
65  num_samples,
66  stream, debug_synchronous
67  )
68  );
69  }
70 
71  template<
72  typename SampleIteratorT,
73  typename CounterT,
74  typename LevelT,
75  typename OffsetT
76  >
77  HIPCUB_RUNTIME_FUNCTION static
78  hipError_t HistogramEven(void * d_temp_storage,
79  size_t& temp_storage_bytes,
80  SampleIteratorT d_samples,
81  CounterT * d_histogram,
82  int num_levels,
83  LevelT lower_level,
84  LevelT upper_level,
85  OffsetT num_row_samples,
86  OffsetT num_rows,
87  size_t row_stride_bytes,
88  hipStream_t stream = 0,
89  bool debug_synchronous = false)
90  {
91  return hipCUDAErrorTohipError(
92  ::cub::DeviceHistogram::HistogramEven(
93  d_temp_storage, temp_storage_bytes,
94  d_samples,
95  d_histogram,
96  num_levels, lower_level, upper_level,
97  num_row_samples, num_rows, row_stride_bytes,
98  stream, debug_synchronous
99  )
100  );
101  }
102 
103  template<
104  int NUM_CHANNELS,
105  int NUM_ACTIVE_CHANNELS,
106  typename SampleIteratorT,
107  typename CounterT,
108  typename LevelT,
109  typename OffsetT
110  >
111  HIPCUB_RUNTIME_FUNCTION static
112  hipError_t MultiHistogramEven(void * d_temp_storage,
113  size_t& temp_storage_bytes,
114  SampleIteratorT d_samples,
115  CounterT * d_histogram[NUM_ACTIVE_CHANNELS],
116  int num_levels[NUM_ACTIVE_CHANNELS],
117  LevelT lower_level[NUM_ACTIVE_CHANNELS],
118  LevelT upper_level[NUM_ACTIVE_CHANNELS],
119  OffsetT num_pixels,
120  hipStream_t stream = 0,
121  bool debug_synchronous = false)
122  {
123  return hipCUDAErrorTohipError(
124  ::cub::DeviceHistogram::MultiHistogramEven<NUM_CHANNELS, NUM_ACTIVE_CHANNELS>(
125  d_temp_storage, temp_storage_bytes,
126  d_samples,
127  d_histogram,
128  num_levels, lower_level, upper_level,
129  num_pixels,
130  stream, debug_synchronous
131  )
132  );
133  }
134 
135  template<
136  int NUM_CHANNELS,
137  int NUM_ACTIVE_CHANNELS,
138  typename SampleIteratorT,
139  typename CounterT,
140  typename LevelT,
141  typename OffsetT
142  >
143  HIPCUB_RUNTIME_FUNCTION static
144  hipError_t MultiHistogramEven(void * d_temp_storage,
145  size_t& temp_storage_bytes,
146  SampleIteratorT d_samples,
147  CounterT * d_histogram[NUM_ACTIVE_CHANNELS],
148  int num_levels[NUM_ACTIVE_CHANNELS],
149  LevelT lower_level[NUM_ACTIVE_CHANNELS],
150  LevelT upper_level[NUM_ACTIVE_CHANNELS],
151  OffsetT num_row_pixels,
152  OffsetT num_rows,
153  size_t row_stride_bytes,
154  hipStream_t stream = 0,
155  bool debug_synchronous = false)
156  {
157  return hipCUDAErrorTohipError(
158  ::cub::DeviceHistogram::MultiHistogramEven<NUM_CHANNELS, NUM_ACTIVE_CHANNELS>(
159  d_temp_storage, temp_storage_bytes,
160  d_samples,
161  d_histogram,
162  num_levels, lower_level, upper_level,
163  num_row_pixels, num_rows, row_stride_bytes,
164  stream, debug_synchronous
165  )
166  );
167  }
168 
169  template<
170  typename SampleIteratorT,
171  typename CounterT,
172  typename LevelT,
173  typename OffsetT
174  >
175  HIPCUB_RUNTIME_FUNCTION static
176  hipError_t HistogramRange(void * d_temp_storage,
177  size_t& temp_storage_bytes,
178  SampleIteratorT d_samples,
179  CounterT * d_histogram,
180  int num_levels,
181  LevelT * d_levels,
182  OffsetT num_samples,
183  hipStream_t stream = 0,
184  bool debug_synchronous = false)
185  {
186  return hipCUDAErrorTohipError(
187  ::cub::DeviceHistogram::HistogramRange(
188  d_temp_storage, temp_storage_bytes,
189  d_samples,
190  d_histogram,
191  num_levels, d_levels,
192  num_samples,
193  stream, debug_synchronous
194  )
195  );
196  }
197 
198  template<
199  typename SampleIteratorT,
200  typename CounterT,
201  typename LevelT,
202  typename OffsetT
203  >
204  HIPCUB_RUNTIME_FUNCTION static
205  hipError_t HistogramRange(void * d_temp_storage,
206  size_t& temp_storage_bytes,
207  SampleIteratorT d_samples,
208  CounterT * d_histogram,
209  int num_levels,
210  LevelT * d_levels,
211  OffsetT num_row_samples,
212  OffsetT num_rows,
213  size_t row_stride_bytes,
214  hipStream_t stream = 0,
215  bool debug_synchronous = false)
216  {
217  return hipCUDAErrorTohipError(
218  ::cub::DeviceHistogram::HistogramRange(
219  d_temp_storage, temp_storage_bytes,
220  d_samples,
221  d_histogram,
222  num_levels, d_levels,
223  num_row_samples, num_rows, row_stride_bytes,
224  stream, debug_synchronous
225  )
226  );
227  }
228 
229  template<
230  int NUM_CHANNELS,
231  int NUM_ACTIVE_CHANNELS,
232  typename SampleIteratorT,
233  typename CounterT,
234  typename LevelT,
235  typename OffsetT
236  >
237  HIPCUB_RUNTIME_FUNCTION static
238  hipError_t MultiHistogramRange(void * d_temp_storage,
239  size_t& temp_storage_bytes,
240  SampleIteratorT d_samples,
241  CounterT * d_histogram[NUM_ACTIVE_CHANNELS],
242  int num_levels[NUM_ACTIVE_CHANNELS],
243  LevelT * d_levels[NUM_ACTIVE_CHANNELS],
244  OffsetT num_pixels,
245  hipStream_t stream = 0,
246  bool debug_synchronous = false)
247  {
248  return hipCUDAErrorTohipError(
249  ::cub::DeviceHistogram::MultiHistogramRange<NUM_CHANNELS, NUM_ACTIVE_CHANNELS>(
250  d_temp_storage, temp_storage_bytes,
251  d_samples,
252  d_histogram,
253  num_levels, d_levels,
254  num_pixels,
255  stream, debug_synchronous
256  )
257  );
258  }
259 
260  template<
261  int NUM_CHANNELS,
262  int NUM_ACTIVE_CHANNELS,
263  typename SampleIteratorT,
264  typename CounterT,
265  typename LevelT,
266  typename OffsetT
267  >
268  HIPCUB_RUNTIME_FUNCTION static
269  hipError_t MultiHistogramRange(void * d_temp_storage,
270  size_t& temp_storage_bytes,
271  SampleIteratorT d_samples,
272  CounterT * d_histogram[NUM_ACTIVE_CHANNELS],
273  int num_levels[NUM_ACTIVE_CHANNELS],
274  LevelT * d_levels[NUM_ACTIVE_CHANNELS],
275  OffsetT num_row_pixels,
276  OffsetT num_rows,
277  size_t row_stride_bytes,
278  hipStream_t stream = 0,
279  bool debug_synchronous = false)
280  {
281  return hipCUDAErrorTohipError(
282  ::cub::DeviceHistogram::MultiHistogramRange<NUM_CHANNELS, NUM_ACTIVE_CHANNELS>(
283  d_temp_storage, temp_storage_bytes,
284  d_samples,
285  d_histogram,
286  num_levels, d_levels,
287  num_row_pixels, num_rows, row_stride_bytes,
288  stream, debug_synchronous
289  )
290  );
291  }
292 };
293 
294 END_HIPCUB_NAMESPACE
295 
296 #endif // HIPCUB_CUB_DEVICE_DEVICE_HISTOGRAM_HPP_
Definition: device_histogram.hpp:40