Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Add example of block radix rank usage
Browse files Browse the repository at this point in the history
  • Loading branch information
gevtushenko committed Aug 31, 2022
1 parent 151e469 commit 4735117
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions cub/block/block_radix_rank.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,34 @@ struct warp_in_block_matcher_t<Bits, 0, PartialWarpId>
* \par Performance Considerations
* - \granularity
*
* \par Examples
* \par
* - <b>Example 1:</b> Simple radix rank of 32-bit integer keys
* \code
* #include <cub/cub.cuh>
* \code
* #include <cub/cub.cuh>
*
* template <int BLOCK_THREADS>
* __global__ void ExampleKernel(...)
* {
* __global__ void ExampleKernel(...)
* {
* constexpr int block_threads = 2;
* constexpr int radix_bits = 5;
*
* \endcode
* // Specialize BlockRadixRank for a 1D block of 2 threads
* using block_radix_rank = cub::BlockRadixRank<block_threads, radix_bits>;
* using storage_t = typename block_radix_rank::TempStorage;
*
* // Allocate shared memory for BlockRadixSort
* __shared__ storage_t temp_storage;
*
* // Obtain a segment of consecutive items that are blocked across threads
* int keys[2];
* int ranks[2];
* ...
*
* cub::BFEDigitExtractor<int> extractor(0, radix_bits);
* block_radix_rank(temp_storage).RankKeys(keys, ranks, extractor);
*
* ...
* \endcode
* Suppose the set of input `keys` across the block of threads is `{ [16,10], [9,11] }`.
* The corresponding output `ranks` in those threads will be `{ [3,1], [0,2] }`.
*
* \par Re-using dynamically allocating shared memory
* The following example under the examples/block folder illustrates usage of
Expand Down

0 comments on commit 4735117

Please sign in to comment.