flâneur — a map of the web's best reading

What happens when you run a CUDA kernel

fergusfinn.com · 7,082 words · saved by 1 readers

Tracing one vector-add kernel from nvcc all the way down to the warps that execute it.

What happens when you run a CUDA kernel 29 Jun 2026 · 35 min read · Cover: Salomon de Caus's pinned-cylinder water organ, engraving from Les Raisons des Forces Mouvantes (1615). Here’s a simple CUDA program. It adds two vectors. __global__ void vadd ( const float* a, const float* b, float* c, int n) { int i = blockIdx.x * blockDim.x + threadIdx.x; if (i < n) c[i] = a[i] + b[i]; } int main () { int n = 1 << 20 ; // a million floats (1,048,576) size_t bytes = n * sizeof ( float ); float * a = ( float* ) malloc (bytes), * b = ( float* ) malloc (bytes), * c = ( float* ) malloc (bytes); for ( int i

Explore this link on the map →

related reading