MUDA
Loading...
Searching...
No Matches
device_adjacent_difference.h
1#pragma once
2#include <muda/cub/device/cub_wrapper.h>
3#if CUB_VERSION >= 200200
4#include "details/cub_wrapper_macro_def.inl"
5#ifndef __INTELLISENSE__
6#include <cub/device/device_adjacent_difference.cuh>
7#else
8namespace cub
9{
10class Difference;
11}
12#endif
13
14namespace muda
15{
16//ref: https://nvlabs.github.io/cub/structcub_1_1_device_adjacent_difference.html
17class DeviceAdjacentDifference : public CubWrapper<DeviceAdjacentDifference>
18{
19 using Base = CubWrapper<DeviceAdjacentDifference>;
20
21 public:
22 using Base::Base;
23 // DeviceVector:
24
25 template <typename InputIteratorT, typename OutputIteratorT, typename DifferenceOpT = cub::Difference>
26 DeviceAdjacentDifference& SubtractLeftCopy(InputIteratorT d_in,
27 OutputIteratorT d_out,
28 int num_items,
29 DifferenceOpT difference_op = {},
30 bool debug_synchronous = false)
31 {
32 MUDA_CUB_WRAPPER_IMPL(cub::DeviceAdjacentDifference::SubtractLeftCopy(
33 d_temp_storage, temp_storage_bytes, d_in, d_out, num_items, difference_op, _stream, debug_synchronous));
34 }
35
36 template <typename RandomAccessIteratorT, typename DifferenceOpT = cub::Difference>
37 DeviceAdjacentDifference& SubtractLeft(RandomAccessIteratorT d_in,
38 int num_items,
39 DifferenceOpT difference_op = {},
40 bool debug_synchronous = false)
41 {
42 MUDA_CUB_WRAPPER_IMPL(cub::DeviceAdjacentDifference::SubtractLeft(
43 d_temp_storage, temp_storage_bytes, d_in, num_items, difference_op, _stream, debug_synchronous));
44 }
45
46 template <typename InputIteratorT, typename OutputIteratorT, typename DifferenceOpT = cub::Difference>
47 DeviceAdjacentDifference& SubtractRightCopy(InputIteratorT d_in,
48 OutputIteratorT d_out,
49 int num_items,
50 DifferenceOpT difference_op = {},
51 bool debug_synchronous = false)
52 {
53 MUDA_CUB_WRAPPER_IMPL(cub::DeviceAdjacentDifference::SubtractRightCopy(
54 d_temp_storage, temp_storage_bytes, d_in, d_out, num_items, difference_op, _stream, debug_synchronous));
55 }
56
57 template <typename RandomAccessIteratorT, typename DifferenceOpT = cub::Difference>
58 DeviceAdjacentDifference& SubtractRight(RandomAccessIteratorT d_in,
59 int num_items,
60 DifferenceOpT difference_op = {},
61 bool debug_synchronous = false)
62 {
63 MUDA_CUB_WRAPPER_IMPL(cub::DeviceAdjacentDifference::SubtractRight(
64 d_temp_storage, temp_storage_bytes, d_in, num_items, difference_op, _stream, debug_synchronous));
65 }
66
67 // Origin:
68
69 template <typename InputIteratorT, typename OutputIteratorT, typename DifferenceOpT = cub::Difference>
70 DeviceAdjacentDifference& SubtractLeftCopy(void* d_temp_storage,
71 size_t& temp_storage_bytes,
72 InputIteratorT d_in,
73 OutputIteratorT d_out,
74 int num_items,
75 DifferenceOpT difference_op = {},
76 bool debug_synchronous = false)
77 {
78 MUDA_CUB_WRAPPER_FOR_COMPUTE_GRAPH_IMPL(cub::DeviceAdjacentDifference::SubtractLeftCopy(
79 d_temp_storage, temp_storage_bytes, d_in, d_out, num_items, difference_op, _stream, debug_synchronous));
80 }
81
82 template <typename RandomAccessIteratorT, typename DifferenceOpT = cub::Difference>
83 DeviceAdjacentDifference& SubtractLeft(void* d_temp_storage,
84 size_t& temp_storage_bytes,
85 RandomAccessIteratorT d_in,
86 int num_items,
87 DifferenceOpT difference_op = {},
88 bool debug_synchronous = false)
89 {
90 MUDA_CUB_WRAPPER_FOR_COMPUTE_GRAPH_IMPL(cub::DeviceAdjacentDifference::SubtractLeft(
91 d_temp_storage, temp_storage_bytes, d_in, num_items, difference_op, _stream, debug_synchronous));
92 }
93
94 template <typename InputIteratorT, typename OutputIteratorT, typename DifferenceOpT = cub::Difference>
95 DeviceAdjacentDifference& SubtractRightCopy(void* d_temp_storage,
96 size_t& temp_storage_bytes,
97 InputIteratorT d_in,
98 OutputIteratorT d_out,
99 int num_items,
100 DifferenceOpT difference_op = {},
101 bool debug_synchronous = false)
102 {
103 MUDA_CUB_WRAPPER_FOR_COMPUTE_GRAPH_IMPL(cub::DeviceAdjacentDifference::SubtractRightCopy(
104 d_temp_storage, temp_storage_bytes, d_in, d_out, num_items, difference_op, _stream, debug_synchronous));
105 }
106
107 template <typename RandomAccessIteratorT, typename DifferenceOpT = cub::Difference>
108 DeviceAdjacentDifference& SubtractRight(void* d_temp_storage,
109 size_t& temp_storage_bytes,
110 RandomAccessIteratorT d_in,
111 int num_items,
112 DifferenceOpT difference_op = {},
113 bool debug_synchronous = false)
114 {
115 MUDA_CUB_WRAPPER_FOR_COMPUTE_GRAPH_IMPL(cub::DeviceAdjacentDifference::SubtractRight(
116 d_temp_storage, temp_storage_bytes, d_in, num_items, difference_op, _stream, debug_synchronous));
117 }
118};
119} // namespace muda
120
121#include "details/cub_wrapper_macro_undef.inl"
122#endif