9

The installation guide says to run the following command:

sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb

But how should I fill distro, version and architecture?

2 Answers 2

8

If you use the CUDA downloads website and selected the appropriate options (say Linux, x86-64, Ubuntu, 16.04 in order), it will show the exact command you're supposed to run:

enter image description here

  • The distro is Ubuntu (16.04 or 14.04 depending on what you're using, run lsb_release -cd to find out).
  • The version is based on the CUDA release you're downloading.
  • For the architecture, see How to find architecture of my PC and Ubuntu? - use uname -m.
3
  • Could you give an example ? What should I write as distro for Ubuntu 16.04 ? And what are the CUDA versions available and how to format them to version ?
    – arthur.sw
    Feb 11, 2020 at 13:34
  • @arthur.sw the site gives you an example. In the screenshot I selected Ubuntu and 16.04, and the resulting instructions had ubuntu1604 in it. The downloads page is best for all of this - developer.nvidia.com/…
    – muru
    Mar 19, 2020 at 2:32
  • yes, maybe what puzzled me is that the instructions appear only once you selected all your choice ; I probably didn't select everything and didn't see the corresponding commands (or - less likely - the site changed since I tried last)
    – arthur.sw
    Mar 19, 2020 at 12:41
2

The CUDA downloads site only reflects the latest version of CUDA. You should check the following as well:

  1. Recommended driver for your hardware. For me on Ubuntu 20.04, my RTX 3090 graphics card should use driver version 470. See the release notes, table 3 for the maximum corresponding CUDA version. In my case it's CUDA 11.4.x.
  2. The GCC required by your CUDA version. On Ubuntu 20.04, the default GCC is 9.x, so my maximum CUDA version is 11.4.0 (i did not want to install a newer GCC).
  3. If you're using other packages that depend on a specific version of CUDA, check those as well (e.g the current latest Pytorch is compiled with CUDA 11.3).
  4. Note the driver version for your chosen CUDA: for 11.3.1, the driver version is 465.19.01.

The downloads site tells me to use cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb. I will change the versions accordingly:

Distro:       ubuntu2004-11-6-local -> ubuntu2004-11-3-local
Version:      11.6.0-510.39.01-1    -> 11.3.1-465.19.01-1 (<CUDA version>-<driver version>)
Architecture: amd64 (no change)

So i change the downloads site output from:

wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pub

to

wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda-repo-ubuntu2004-11-3-local_11.3.1-465.19.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-3-local_11.3.1-465.19.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pub

If you've installed the wrong version (e.g. 11.6) and want to undo, you can use

sudo apt remove cuda
sudo dpkg remove cuda
sudo apt-key remove /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pub
sudo rm /etc/apt/sources.list.d/cuda-ubuntu2004-11-6-local.list
sudo rm -r /usr/local/cuda-11.6 
sudo rm /etc/alternatives/cuda /etc/alternatives/cuda-11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .