Grid-Stride Loops
Handling arrays larger than the grid.
When the Array Is Huge
Sometimes the data is far bigger than the threads you launch. One thread per element no longer fits, so you need each thread to handle several elements.
The Grid Has a Size
The total number of threads is the grid size: blocks times threads per block. This stride is how far apart each thread's elements sit.
int stride = blockDim.x * gridDim.x;