What is the correct version of CUDA for my nvidia driver?

304.xx is a driver that will support CUDA 5 and previous (does not support newer CUDA versions.)

If you want to reinstall ubuntu to create a clean setup, the linux getting started guide has all the instructions needed to set up CUDA if that is your intent.

I believe you are picking up a 304.xx driver via a specific (ie. separate) driver install. This is not necessary if you want to use CUDA 7, you can just use the runfile installer method which has all the necessary components including an appropriate driver (346.46). Note that CUDA 7 will not be usable with older CUDA GPUs of compute capability 1.x. For those GPUs, CUDA 6.5 should work. Starting with CUDA 9.x, older CUDA GPUs of compute capability 2.x are also not supported. Older CUDA toolkits are available for download here. Note that any given CUDA toolkit has specific Linux distros (including version number) that are supported. Not all distros are supported on every CUDA toolkit version. The general support matrix is contained in the linux install guide for the specific CUDA version of interest.

For reference, on linux, the previous CUDA toolkits required the following minimum driver versions:

For versions newer than 11.0, refer to the table in the release notes linked below
CUDA 11.0: 450.36.06
CUDA 10.2: 440.33.01
CUDA 10.1: 418.39
CUDA 10.0: 410.48
CUDA  9.2: 396.xx
CUDA  9.1: 390.xx (update)
CUDA  9.0: 384.xx
CUDA  8.0  375.xx (GA2)
CUDA  8.0: 367.4x
CUDA  7.5: 352.xx
CUDA  7.0: 346.xx
CUDA  6.5: 340.xx
CUDA  6.0: 331.xx
CUDA  5.5: 319.xx
CUDA  5.0: 304.xx
CUDA  4.2: 295.41
CUDA  4.1: 285.05.33
CUDA  4.0: 270.41.19
CUDA  3.2: 260.19.26
CUDA  3.1: 256.40
CUDA  3.0: 195.36.15

A portion of this table is maintained as Table 3 here in the release notes.

This answer may also be of interest.


The driver version is only half of the compatibility equation. The other half is the Compute Capability. A GPU will support a specific compute version, and if your CUDA version minimum compute capability is higher than that supported by your GPU, your code will not compile or run. For instance, my laptop has an nVidia CUDA 2.1 GPU, which means I can't install a CUDA toolkit more recent than CUDA 8.0 GA2. This in turn means that I need to install an nVidia driver that is compatible with my CUDA version.

CUDA Version        Minimum Compute Capability  Default Compute Capability
CUDA 10.0           3.0                         3.0
CUDA 9.2 update 1   3.0                         3.0
CUDA 9.2            3.0                         3.0
CUDA 9.1            3.0                         3.0
CUDA 9.0            3.0                         3.0
CUDA 8.0 GA2        2.0                         2.0
CUDA 8.0            2.0                         2.0
CUDA 7.5            2.0                         2.0
CUDA 7.0            2.0                         2.0
CUDA 6.5            1.1                         2.0
CUDA 6.0            1.0                         1.0
CUDA 5.5            1.0                         1.0
CUDA 5.0            1.0                         1.0
CUDA 4.2            1.0                         1.0
CUDA 4.1            1.0                         1.0
CUDA 4.0            1.0                         1.0
CUDA 3.2            1.0                         1.0
CUDA 3.1            1.0                         1.0
CUDA 3.0            1.0                         1.0

The third thing you may need to consider is compiler compatibility. For instance, a minimum version of the gcc compiler is needed for compatibility with specific CUDA versions.