CUDA Errors: Causes and Fixes

The errors people search for most, with code you can run

Each guide explains what the error means, the usual causes, a small program that reproduces it and a fixed version. Both run on a real NVIDIA GPU in the playground, and the output shown is what they printed there.

Checking for errors

Most CUDA errors are reported by the call after the one that caused them. Check every runtime call and every kernel launch; the cudaGetLastError page has a standard CUDA_CHECK macro.