
Graphics Processing Unit Programming and ApplicationsGraphics Processing Unit Programming and Applications 99
The number of threads per block, the quantity of blocks within a grid
and their respective array are defi ned by parameters given at the kernel
launch. These parameters are dimBlock and dimGrid. Figure 4.2 shows
the corresponding kernel defi nition for the array showed in Fig. 4.1. Note
that the z-value for dimGrid is ignored as grids are only 2-D arrays.
dim3 dimBlock(5, 3, 2);
dim3 dimGrid(3, 2);
Kernel1<<<dimGrid, dimBlock>>>(...);
Fig. 4.2 Defi ning dimBlock and dimGrid parameters.
4.2.4 Memory spaces and hierarchy
CUDA threads work with ...