GPU Programming
Which correctly orders the CUDA thread hierarchy from largest to smallest?
- AGrid → block → thread
- BThread → block → grid
- CBlock → thread → grid
Show answer and explanation
Answer: A. Grid → block → thread
One kernel launch forms a grid, which is divided into many blocks, each containing many threads. A block's threads run on the same SM (a cluster of execution units) and can cooperate through shared memory and synchronize. Different blocks run independently, so the number running at once adapts to the GPU's size, and the same program runs on small and large GPUs.
- A. Correct. The whole of one launch is the grid.
- B. That is smallest to largest.
- C. The order is wrong.