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

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

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