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