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

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zasdfgbnm committed Nov 13, 2021
1 parent de6a836 commit ef38acc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cub/device/device_select.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ struct DeviceSelect
}


/** TODO: update this doc
* \brief Given an input sequence \p d_in having runs of consecutive equal-valued keys, only the first key from each run is selectively copied to \p d_out. The total number of items selected is written to \p d_num_selected_out. ![](unique_logo.png)
/**
* \brief Given an input sequence \p d_keys_in and \p d_values_in with runs of key-value pairs with consecutive equal-valued keys, only the first key and its value from each run is selectively copied to \p d_keys_out and \p d_values_out. The total number of items selected is written to \p d_num_selected_out. ![](unique_logo.png)
*
* \par
* - The <tt>==</tt> equality operator is used to determine whether keys are equivalent
Expand All @@ -369,23 +369,26 @@ struct DeviceSelect
*
* // Declare, allocate, and initialize device-accessible pointers for input and output
* int num_items; // e.g., 8
* int *d_in; // e.g., [0, 2, 2, 9, 5, 5, 5, 8]
* int *d_out; // e.g., [ , , , , , , , ]
* int *d_keys_in; // e.g., [0, 2, 2, 9, 5, 5, 5, 8]
* int *d_values_in; // e.g., [1, 2, 3, 4, 5, 6, 7, 8]
* int *d_keys_out; // e.g., [ , , , , , , , ]
* int *d_values_out; // e.g., [ , , , , , , , ]
* int *d_num_selected_out; // e.g., [ ]
* ...
*
* // Determine temporary device storage requirements
* void *d_temp_storage = NULL;
* size_t temp_storage_bytes = 0;
* cub::DeviceSelect::Unique(d_temp_storage, temp_storage_bytes, d_in, d_out, d_num_selected_out, num_items);
* cub::DeviceSelect::UniqueByKey(d_temp_storage, temp_storage_bytes, d_keys_in, d_values_in, d_keys_out, d_values_out, d_num_selected_out, num_items);
*
* // Allocate temporary storage
* cudaMalloc(&d_temp_storage, temp_storage_bytes);
*
* // Run selection
* cub::DeviceSelect::Unique(d_temp_storage, temp_storage_bytes, d_in, d_out, d_num_selected_out, num_items);
* cub::DeviceSelect::UniqueByKey(d_temp_storage, temp_storage_bytes, d_keys_in, d_values_in, d_keys_out, d_values_out, d_num_selected_out, num_items);
*
* // d_out <-- [0, 2, 9, 5, 8]
* // d_keys_out <-- [0, 2, 9, 5, 8]
* // d_values_out <-- [1, 2, 4, 5, 8]
* // d_num_selected_out <-- [5]
*
* \endcode
Expand Down

0 comments on commit ef38acc

Please sign in to comment.