cuda::experimental::distribute
Defined in include/cuda/experimental/__launch/configuration.cuh
-
template<int _ThreadsPerBlock>
constexpr auto cuda::experimental::distribute(int numElements) noexcept A shorthand for creating a kernel configuration with a hierarchy of CUDA threads evenly distributing elements among blocks and threads.
- Snippet
#include <cudax/hierarchy_dimensions.cuh> using namespace cuda::experimental; constexpr int threadsPerBlock = 256; auto dims = distribute<threadsPerBlock>(numElements); // Equivalent to: constexpr int threadsPerBlock = 256; int blocksPerGrid = (numElements + threadsPerBlock - 1) / threadsPerBlock; auto dims = make_hierarchy(grid_dims(blocksPerGrid), block_dims<threadsPerBlock>());