nvcc --version: Check the CUDA Toolkit
nvcc --version prints the CUDA Toolkit (compiler) version installed on the machine, which is distinct from the driver CUDA version nvidia-smi reports.
Two CUDA versions matter: the toolkit you compile with (nvcc) and the maximum the driver supports (nvidia-smi). Confusing them causes most "version insufficient" failures.
What it does
nvcc --version prints the CUDA compiler driver release, e.g. "Cuda compilation tools, release 12.4, V12.4.131". This is the toolkit version used to compile code, independent of the display driver.
Common usage
nvcc --version
# where is nvcc?
which nvcc
# compare with the driver's max CUDA version
nvidia-smi | grep "CUDA Version"Options
| Flag | What it does |
|---|---|
| --version / -V | Print the CUDA Toolkit compiler version |
| --help / -h | List all nvcc options |
| PATH | Must include /usr/local/cuda/bin for nvcc to be found |
| LD_LIBRARY_PATH | Must include /usr/local/cuda/lib64 at runtime |
In CI
The driver CUDA version (nvidia-smi) is an upper bound; the toolkit version (nvcc) is what you build against. A newer toolkit than the driver supports triggers runtime version errors. Add /usr/local/cuda/bin to PATH in the job so nvcc resolves.
Common errors in CI
"nvcc: command not found" means the CUDA Toolkit is not installed or /usr/local/cuda/bin is not on PATH (the base image may ship only the runtime, not the toolkit). A build that runs but the app then fails with "CUDA driver version is insufficient for CUDA runtime version" means the toolkit is newer than the driver supports; downgrade the toolkit or update the driver.