Expand description
Grid and block dimension types for kernel launch configuration.
CUDA kernels are launched with a grid of thread blocks. Each block contains threads organized in up to 3 dimensions.
§Dimension model
The CUDA execution model uses a two-level hierarchy:
- Grid: A collection of thread blocks, specified as up to 3D dimensions.
- Block: A collection of threads within a block, also up to 3D.
Both are described by Dim3, which defaults unused dimensions to 1.
§Helper function
The grid_size_for function computes the minimum grid size needed
to cover a given number of elements with a given block size (ceiling
division).
Structs§
- Dim3
- 3-dimensional size specification for grids and blocks.
Functions§
- auto_
grid_ 2d - Computes optimal grid and block dimensions for a 2D problem.
- auto_
grid_ for - Computes optimal grid and block dimensions for a 1D problem of
nelements. - grid_
size_ for - Calculate the grid size needed to cover
nelements withblock_sizethreads.