Score:1

Force CUDA toolkit version 11.6 in Ubuntu 18.04, latest in repos is 9.1

gp flag

I just installed cuda following instructions in nvidia site:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda-repo-ubuntu1804-11-6-local_11.6.0-510.39.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-6-local_11.6.0-510.39.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-6-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

I then installed nvidia-cuda-toolkit:

sudo apt install nvidia-cuda-toolkit

All of this went without issues, but it installed the version 9.1 of the toolkit:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

I need to have version 11.1 or later of the toolkit, but it seems 9.1 is the latest in the repos:

$ sudo apt install nvidia-cuda-toolkit
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nvidia-cuda-toolkit is already the newest version (9.1.85-3ubuntu1).

How can I force the installation of the latest?

This are the details of my system:

$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.6 LTS"
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

$ uname -m
x86_64

$ uname -r
4.15.0-167-generic

Thanks in advance!

Score:1
zw flag

If you are following official guide, you follow it partially.

You have to install one of the following meta-packages:

Meta Package Purpose
cuda Installs all CUDA Toolkit and Driver packages. Handles upgrading to the next version of the cuda package when it's released.
cuda-11-6 Installs all CUDA Toolkit and Driver packages. Remains at version 11.6 until an additional version of CUDA is installed.
cuda-toolkit-11-6 Installs all CUDA Toolkit packages required to develop CUDA applications. Does not include the driver.
cuda-tools-11-6 Installs all CUDA command line and visual tools.
cuda-runtime-11-6 Installs all CUDA Toolkit packages required to run CUDA applications, as well as the Driver packages.
cuda-compiler-11-6 Installs all CUDA compiler packages.
cuda-libraries-11-6 Installs all runtime CUDA Library packages.
cuda-libraries-dev-11-6 Installs all development CUDA Library packages.
cuda-drivers Installs all Driver packages. Handles upgrading to the next version of the Driver packages when they're released.

So the easiest way would be

sudo apt-get install cuda

to get latest CUDA 11.6 version fully installed. For example its compiler will be installed in this location:

$ which nvcc 
/usr/local/cuda-11.6/bin/nvcc

with needed 11.6 version

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:16:03_PST_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0

Also you should know that nvidia-cuda-toolkit package came from Ubuntu repositories as shown below

$ apt-cache policy nvidia-cuda-toolkit 
nvidia-cuda-toolkit:
 Installed: (none)
 Candidate: 9.1.85-3ubuntu1
 Version table:
    9.1.85-3ubuntu1 500
       500 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages

so you should not use it.

lbal avatar
gp flag
Thanks for your answer! I'm a fool. I had installed cuda as you recommended, but I thought that was only the drivers and not the toolkit. Also, the reason nvcc comand wasn't working before I installed the nvidia-cuda-toolkit (already removed, thanks), is because the cuda bin wasn't in the path. All fixed now, thanks for your help.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.