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.
- CUDA error: an illegal memory access was encountered
- CUDA error: out of memory
- CUDA error: device-side assert triggered
- CUDA error: invalid configuration argument
- CUDA error: invalid device ordinal
- CUDA kernel printf not showing (or the kernel does not run)
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.