When one block cannot cover a large array, CUDA spreads the work across multiple blocks. Picture a school: classrooms handle separate stacks of exams, while students within each classroom do the individual work. section 3.0 section 3.2
A kernel launch organizes work into three levels:
- Grid: all blocks launched by one kernel call. section 3.2
- Block: a group of threads; every block in a launch has the same number of threads. section 3.2
- Thread: the smallest unit that does the work. section 3.2
myKernel<<<4, 256>>>(); // 4 classrooms, 256 students each
This launch creates a grid of 4 blocks, each with 256 threads: 1,024 threads total. section 3.2
Each block runs on one streaming multiprocessor (SM), which runs it from start to finish. Blocks may execute in any order, so independent work is safe, but code must not rely on one block finishing before another. Extra blocks wait until an SM is available. section 3.2
