/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-hipcub/checkouts/docs-5.5.1/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.5.1/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.5.1/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, 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  return hipCUDAErrorTohipError(
54  ::cub::DeviceAdjacentDifference::SubtractLeftCopy(
55  d_temp_storage, temp_storage_bytes, d_input, d_output,
56  num_items, difference_op, stream, debug_synchronous
57  )
58  );
59  }
60 
61  template<typename RandomAccessIteratorT,
62  typename DifferenceOpT = ::cub::Difference,
63  typename NumItemsT = std::uint32_t>
64  static HIPCUB_RUNTIME_FUNCTION hipError_t SubtractLeft(void* d_temp_storage,
65  std::size_t& temp_storage_bytes,
66  RandomAccessIteratorT d_input,
67  NumItemsT num_items,
68  DifferenceOpT difference_op = {},
69  hipStream_t stream = 0,
70  bool debug_synchronous = false)
71  {
72  return hipCUDAErrorTohipError(
73  ::cub::DeviceAdjacentDifference::SubtractLeft(
74  d_temp_storage, temp_storage_bytes, d_input,
75  num_items, difference_op, stream, debug_synchronous
76  )
77  );
78  }
79 
80  template<typename InputIteratorT,
81  typename OutputIteratorT,
82  typename DifferenceOpT = ::cub::Difference,
83  typename NumItemsT = std::uint32_t>
84  static HIPCUB_RUNTIME_FUNCTION hipError_t SubtractRightCopy(void* d_temp_storage,
85  std::size_t& temp_storage_bytes,
86  InputIteratorT d_input,
87  OutputIteratorT d_output,
88  NumItemsT num_items,
89  DifferenceOpT difference_op = {},
90  hipStream_t stream = 0,
91  bool debug_synchronous = false)
92  {
93  return hipCUDAErrorTohipError(
94  ::cub::DeviceAdjacentDifference::SubtractRightCopy(
95  d_temp_storage, temp_storage_bytes, d_input, d_output,
96  num_items, difference_op, stream, debug_synchronous
97  )
98  );
99  }
100 
101  template<typename RandomAccessIteratorT,
102  typename DifferenceOpT = ::cub::Difference,
103  typename NumItemsT = std::uint32_t>
104  static HIPCUB_RUNTIME_FUNCTION hipError_t SubtractRight(void* d_temp_storage,
105  std::size_t& temp_storage_bytes,
106  RandomAccessIteratorT d_input,
107  NumItemsT num_items,
108  DifferenceOpT difference_op = {},
109  hipStream_t stream = 0,
110  bool debug_synchronous = false)
111  {
112  return hipCUDAErrorTohipError(
113  ::cub::DeviceAdjacentDifference::SubtractRight(
114  d_temp_storage, temp_storage_bytes, d_input,
115  num_items, difference_op, stream, debug_synchronous
116  )
117  );
118  }
119 };
120 
121 END_HIPCUB_NAMESPACE
122 
123 #endif // HIPCUB_CUB_DEVICE_DEVICE_ADJACENT_DIFFERENCE_HPP_
Definition: device_adjacent_difference.hpp:39