|
CUB
|
DeviceReduce provides device-wide, parallel operations for computing a reduction across a sequence of data items residing within global memory.
CUB_CDP macro in your compiler's macro definitions.int32 keys.
fp32 values. Segments are identified by int32 keys, and have lengths uniformly sampled from [1,1000].
Definition at line 82 of file device_reduce.cuh.
Static Public Methods | |
| template<typename InputIteratorT , typename OutputIteratorT , typename ReductionOp > | |
| static CUB_RUNTIME_FUNCTION cudaError_t | Reduce (void *d_temp_storage, size_t &temp_storage_bytes, InputIteratorT d_in, OutputIteratorT d_out, int num_items, ReductionOp reduction_op, cudaStream_t stream=0, bool debug_synchronous=false) |
Computes a device-wide reduction using the specified binary reduction_op functor. More... | |
| template<typename InputIteratorT , typename OutputIteratorT > | |
| static CUB_RUNTIME_FUNCTION cudaError_t | Sum (void *d_temp_storage, size_t &temp_storage_bytes, InputIteratorT d_in, OutputIteratorT d_out, int num_items, cudaStream_t stream=0, bool debug_synchronous=false) |
| Computes a device-wide sum using the addition ('+') operator. More... | |
| template<typename InputIteratorT , typename OutputIteratorT > | |
| static CUB_RUNTIME_FUNCTION cudaError_t | Min (void *d_temp_storage, size_t &temp_storage_bytes, InputIteratorT d_in, OutputIteratorT d_out, int num_items, cudaStream_t stream=0, bool debug_synchronous=false) |
| Computes a device-wide minimum using the less-than ('<') operator. More... | |
| template<typename InputIteratorT , typename OutputIteratorT > | |
| static CUB_RUNTIME_FUNCTION cudaError_t | ArgMin (void *d_temp_storage, size_t &temp_storage_bytes, InputIteratorT d_in, OutputIteratorT d_out, int num_items, cudaStream_t stream=0, bool debug_synchronous=false) |
| Finds the first device-wide minimum using the less-than ('<') operator, also returning the index of that item. More... | |
| template<typename InputIteratorT , typename OutputIteratorT > | |
| static CUB_RUNTIME_FUNCTION cudaError_t | Max (void *d_temp_storage, size_t &temp_storage_bytes, InputIteratorT d_in, OutputIteratorT d_out, int num_items, cudaStream_t stream=0, bool debug_synchronous=false) |
| Computes a device-wide maximum using the greater-than ('>') operator. More... | |
| template<typename InputIteratorT , typename OutputIteratorT > | |
| static CUB_RUNTIME_FUNCTION cudaError_t | ArgMax (void *d_temp_storage, size_t &temp_storage_bytes, InputIteratorT d_in, OutputIteratorT d_out, int num_items, cudaStream_t stream=0, bool debug_synchronous=false) |
| Finds the first device-wide maximum using the greater-than ('>') operator, also returning the index of that item. More... | |
| template<typename KeysInputIteratorT , typename UniqueOutputIteratorT , typename ValuesInputIteratorT , typename AggregatesOutputIteratorT , typename NumRunsOutputIteratorT , typename ReductionOp > | |
| CUB_RUNTIME_FUNCTION static __forceinline__ cudaError_t | ReduceByKey (void *d_temp_storage, size_t &temp_storage_bytes, KeysInputIteratorT d_keys_in, UniqueOutputIteratorT d_unique_out, ValuesInputIteratorT d_values_in, AggregatesOutputIteratorT d_aggregates_out, NumRunsOutputIteratorT d_num_runs_out, ReductionOp reduction_op, int num_items, cudaStream_t stream=0, bool debug_synchronous=false) |
| Reduces segments of values, where segments are demarcated by corresponding runs of identical keys. More... | |
|
inlinestatic |
Computes a device-wide reduction using the specified binary reduction_op functor.
d_temp_storage is NULL, no work is done and the required allocation size is returned in temp_storage_bytes.int items. | InputIteratorT | [inferred] Random-access input iterator type for reading input items (may be a simple pointer type) |
| OutputIteratorT | [inferred] Output iterator type for recording the reduced aggregate (may be a simple pointer type) |
| ReductionOp | [inferred] Binary reduction functor type having member T operator()(const T &a, const T &b) (e.g., cub::Sum, cub::Min, cub::Max, etc.) |
| [in] | d_temp_storage | Device allocation of temporary storage. When NULL, the required allocation size is written to temp_storage_bytes and no work is done. |
| [in,out] | temp_storage_bytes | Reference to size in bytes of d_temp_storage allocation |
| [in] | d_in | Pointer to the input sequence of data items |
| [out] | d_out | Pointer to the output aggregate |
| [in] | num_items | Total number of input items (i.e., length of d_in) |
| [in] | reduction_op | Binary reduction functor (e.g., an instance of cub::Sum, cub::Min, cub::Max, etc.) |
| [in] | stream | [optional] CUDA stream to launch kernels within. Default is stream0. |
| [in] | debug_synchronous | [optional] Whether or not to synchronize the stream after every kernel launch to check for errors. Also causes launch configurations to be printed to the console. Default is false. |
Definition at line 142 of file device_reduce.cuh.
|
inlinestatic |
Computes a device-wide sum using the addition ('+') operator.
d_temp_storage is NULL, no work is done and the required allocation size is returned in temp_storage_bytes.int32 and int64 items, respectively.
int items. | InputIteratorT | [inferred] Random-access input iterator type for reading input items (may be a simple pointer type) |
| OutputIteratorT | [inferred] Output iterator type for recording the reduced aggregate (may be a simple pointer type) |
| [in] | d_temp_storage | Device allocation of temporary storage. When NULL, the required allocation size is written to temp_storage_bytes and no work is done. |
| [in,out] | temp_storage_bytes | Reference to size in bytes of d_temp_storage allocation |
| [in] | d_in | Pointer to the input sequence of data items |
| [out] | d_out | Pointer to the output aggregate |
| [in] | num_items | Total number of input items (i.e., length of d_in) |
| [in] | stream | [optional] CUDA stream to launch kernels within. Default is stream0. |
| [in] | debug_synchronous | [optional] Whether or not to synchronize the stream after every kernel launch to check for errors. Also causes launch configurations to be printed to the console. Default is false. |
Definition at line 219 of file device_reduce.cuh.
|
inlinestatic |
Computes a device-wide minimum using the less-than ('<') operator.
d_temp_storage is NULL, no work is done and the required allocation size is returned in temp_storage_bytes.int items. | InputIteratorT | [inferred] Random-access input iterator type for reading input items (may be a simple pointer type) |
| OutputIteratorT | [inferred] Output iterator type for recording the reduced aggregate (may be a simple pointer type) |
| [in] | d_temp_storage | Device allocation of temporary storage. When NULL, the required allocation size is written to temp_storage_bytes and no work is done. |
| [in,out] | temp_storage_bytes | Reference to size in bytes of d_temp_storage allocation |
| [in] | d_in | Pointer to the input sequence of data items |
| [out] | d_out | Pointer to the output aggregate |
| [in] | num_items | Total number of input items (i.e., length of d_in) |
| [in] | stream | [optional] CUDA stream to launch kernels within. Default is stream0. |
| [in] | debug_synchronous | [optional] Whether or not to synchronize the stream after every kernel launch to check for errors. Also causes launch configurations to be printed to the console. Default is false. |
Definition at line 291 of file device_reduce.cuh.
|
inlinestatic |
Finds the first device-wide minimum using the less-than ('<') operator, also returning the index of that item.
d_in has value type T, the output d_out must have value type KeyValuePair<int, T>. The minimum value is written to d_out.value and its location in the input array is written to d_out.key.d_temp_storage is NULL, no work is done and the required allocation size is returned in temp_storage_bytes.int items. | InputIteratorT | [inferred] Random-access input iterator type for reading input items (of some type T) (may be a simple pointer type) |
| OutputIteratorT | [inferred] Output iterator type for recording the reduced aggregate (having value type KeyValuePair<int, T>) (may be a simple pointer type) |
| [in] | d_temp_storage | Device allocation of temporary storage. When NULL, the required allocation size is written to temp_storage_bytes and no work is done. |
| [in,out] | temp_storage_bytes | Reference to size in bytes of d_temp_storage allocation |
| [in] | d_in | Pointer to the input sequence of data items |
| [out] | d_out | Pointer to the output aggregate |
| [in] | num_items | Total number of input items (i.e., length of d_in) |
| [in] | stream | [optional] CUDA stream to launch kernels within. Default is stream0. |
| [in] | debug_synchronous | [optional] Whether or not to synchronize the stream after every kernel launch to check for errors. Also causes launch configurations to be printed to the console. Default is false. |
Definition at line 368 of file device_reduce.cuh.
|
inlinestatic |
Computes a device-wide maximum using the greater-than ('>') operator.
d_temp_storage is NULL, no work is done and the required allocation size is returned in temp_storage_bytes.int items. | InputIteratorT | [inferred] Random-access input iterator type for reading input items (may be a simple pointer type) |
| OutputIteratorT | [inferred] Output iterator type for recording the reduced aggregate (may be a simple pointer type) |
| [in] | d_temp_storage | Device allocation of temporary storage. When NULL, the required allocation size is written to temp_storage_bytes and no work is done. |
| [in,out] | temp_storage_bytes | Reference to size in bytes of d_temp_storage allocation |
| [in] | d_in | Pointer to the input sequence of data items |
| [out] | d_out | Pointer to the output aggregate |
| [in] | num_items | Total number of input items (i.e., length of d_in) |
| [in] | stream | [optional] CUDA stream to launch kernels within. Default is stream0. |
| [in] | debug_synchronous | [optional] Whether or not to synchronize the stream after every kernel launch to check for errors. Also causes launch configurations to be printed to the console. Default is false. |
Definition at line 444 of file device_reduce.cuh.
|
inlinestatic |
Finds the first device-wide maximum using the greater-than ('>') operator, also returning the index of that item.
d_in has value type T, the output d_out must have value type KeyValuePair<int, T>. The maximum value is written to d_out.value and its location in the input array is written to d_out.key.d_temp_storage is NULL, no work is done and the required allocation size is returned in temp_storage_bytes.int items. | InputIteratorT | [inferred] Random-access input iterator type for reading input items (of some type T) (may be a simple pointer type) |
| OutputIteratorT | [inferred] Output iterator type for recording the reduced aggregate (having value type KeyValuePair<int, T>) (may be a simple pointer type) |
| [in] | d_temp_storage | Device allocation of temporary storage. When NULL, the required allocation size is written to temp_storage_bytes and no work is done. |
| [in,out] | temp_storage_bytes | Reference to size in bytes of d_temp_storage allocation |
| [in] | d_in | Pointer to the input sequence of data items |
| [out] | d_out | Pointer to the output aggregate |
| [in] | num_items | Total number of input items (i.e., length of d_in) |
| [in] | stream | [optional] CUDA stream to launch kernels within. Default is stream0. |
| [in] | debug_synchronous | [optional] Whether or not to synchronize the stream after every kernel launch to check for errors. Also causes launch configurations to be printed to the console. Default is false. |
Definition at line 521 of file device_reduce.cuh.
|
inlinestatic |
Reduces segments of values, where segments are demarcated by corresponding runs of identical keys.
d_values_in using the specified binary reduction_op functor. The segments are identified by "runs" of corresponding keys in d_keys_in, where runs are maximal ranges of consecutive, identical keys. For the ith run encountered, the first key of the run and the corresponding value aggregate of that run are written to d_unique_out[i] and d_aggregates_out[i], respectively. The total number of runs encountered is written to d_num_runs_out.== equality operator is used to determine whether keys are equivalentd_temp_storage is NULL, no work is done and the required allocation size is returned in temp_storage_bytes.fp32 and fp64 values, respectively. Segments are identified by int32 keys, and have lengths uniformly sampled from [1,1000].
int values grouped by runs of associated int keys. | KeysInputIteratorT | [inferred] Random-access input iterator type for reading input keys (may be a simple pointer type) |
| UniqueOutputIteratorT | [inferred] Random-access output iterator type for writing unique output keys (may be a simple pointer type) |
| ValuesInputIteratorT | [inferred] Random-access input iterator type for reading input values (may be a simple pointer type) |
| AggregatesOutputIterator | [inferred] Random-access output iterator type for writing output value aggregates (may be a simple pointer type) |
| NumRunsOutputIteratorT | [inferred] Output iterator type for recording the number of runs encountered (may be a simple pointer type) |
| ReductionOp | [inferred] Binary reduction functor type having member T operator()(const T &a, const T &b) (e.g., cub::Sum, cub::Min, cub::Max, etc.) |
| [in] | d_temp_storage | Device allocation of temporary storage. When NULL, the required allocation size is written to temp_storage_bytes and no work is done. |
| [in,out] | temp_storage_bytes | Reference to size in bytes of d_temp_storage allocation |
| [in] | d_keys_in | Pointer to the input sequence of keys |
| [out] | d_unique_out | Pointer to the output sequence of unique keys (one key per run) |
| [in] | d_values_in | Pointer to the input sequence of corresponding values |
| [out] | d_aggregates_out | Pointer to the output sequence of value aggregates (one aggregate per run) |
| [out] | d_num_runs_out | Pointer to total number of runs encountered (i.e., the length of d_unique_out) |
| [in] | reduction_op | Binary reduction functor (e.g., an instance of cub::Sum, cub::Min, cub::Max, etc.) |
| [in] | num_items | Total number of associated key+value pairs (i.e., the length of d_in_keys and d_in_values) |
| [in] | stream | [optional] CUDA stream to launch kernels within. Default is stream0. |
| [in] | debug_synchronous | [optional] Whether or not to synchronize the stream after every kernel launch to check for errors. May cause significant slowdown. Default is false. |
Definition at line 642 of file device_reduce.cuh.
1.8.4