-** CUDA ** (Compute Unified Device Architecture) is a development environment for creating GPU-accelerated applications developed by Nvidia.
-** nvidia-driver **, as the name suggests, is a driver for controlling Nvidia GPUs such as the GTX
and RTX
series.
To briefly explain these two roles, ** nvidia-driver ** acts as an intermediary between hardware and OS, and a toolkit (application group) called ** CUDA ** is used for programs such as python
. Provides resources.
In the past, it was necessary to stop the running graphic driver, re-burn the kernel with dkms
, etc., but today it can be easily installed with just one deb
file.
Here are the steps to install
CUDA 11.2
onUbuntu 16.04
.
.deb
file download command.First, access CUDA Toolkit 11.2 Downloads.
--If you select Linux
-> x86_64
-> Ubuntu
-> 16.04
-> deb (local)
Download Installer for Linux Ubuntu 16.04 x86_64
You will see how to download the .deb
file in the content box.
deb
fileThe commands actually displayed are shown below, but since they are just examples, be sure to enter the commands displayed in the content box when you operated them yourself.
#Register priority in repository
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-ubuntu1604.pin
sudo mv cuda-ubuntu1604.pin /etc/apt/preferences.d/cuda-repository-pin-600
#Download deb file
wget https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda-repo-ubuntu1604-11-2-local_11.2.0-460.27.04-1_amd64.deb
#Install packages on your system using deb files
sudo dpkg -i cuda-repo-ubuntu1604-11-2-local_11.2.0-460.27.04-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1604-11-2-local/7fa2af80.pub
#Updated package list
sudo apt-get update
I was able to install the package with dpkg -i
, but it has not been reflected in the system yet. Finally, use the sudo apt install
command to apply the package to your system, but be careful here. In the content box, it says sudo apt install cuda
, but you need to change the metapackage to reflect it according to your purpose.
The list of meta packages is excerpted from the official website (3.10.3. Meta Packages) and translated into Japanese below. The following two meta packages are mainly specified.
cuda-11-2
--When installing a new CUDA itself.cuda-toolkit-11-2
--When nvidia-driver
is already installed
--When you already have another CUDA and want to install another version of CUDA.
--If you overwrite the driver poorly, the machine will stop working.By the way, in the case of CUDA 10.1
, the meta package name is cuda-10-1
. Please convert it on a case-by-case basis.
Meta Package | Purpose |
---|---|
cuda | Install all CUDA toolkits and driver packages. When a new cuda package is released, it will automatically handle the upgrade to the next version. |
cuda-11-2 | Install all CUDA toolkits and driver packages. Versions until an additional version of CUDA is installed11.2 It will be fixed as it is. |
cuda-toolkit-11-2 | Install all the CUDA toolkit packages needed to develop CUDA applications. Driver not included. |
cuda-tools-11-2 | Install all CUDA command line and visual tools. |
cuda-runtime-11-2 | Install all the CUDA toolkit packages and driver packages needed to run your CUDA application. |
cuda-compiler-11-2 | Install all CUDA compiler packages. |
cuda-libraries-11-2 | Install all runtime CUDA library packages. |
cuda-libraries-dev-11-2 | Install all development CUDA library packages. |
cuda-drivers | Install all driver packages. Upon release, it handles upgrades to the next version of the driver package. |
sudo apt install cuda-11-2
Or
sudo apt install cuda-toolkit-11-2
Apply the CUDA package to your system with.
** CUDA ** and ** nvidia-driver ** are compatible. If you want to know more, please refer to the official website below.
CUDA Toolkit | Linux x86_64 Driver Version |
---|---|
CUDA 11.1 (11.1.0) | >= 450.80.02 |
CUDA 11.0 (11.0.3) | >= 450.36.06 |
CUDA 10.2 (10.2.89) | >= 440.33 |
CUDA 10.1 (10.1.105) | >= 418.39 |
CUDA 10.0 (10.0.130) | >= 410.48 |
CUDA 9.2 (9.2.88) | >= 396.26 |
CUDA 9.1 (9.1.85) | >= 390.46 |
CUDA 9.0 (9.0.76) | >= 384.81 |
CUDA 8.0 (8.0.61 GA2) | >= 375.26 |
CUDA 8.0 (8.0.44) | >= 367.48 |
CUDA 7.5 (7.5.16) | >= 352.31 |
CUDA 7.0 (7.0.28) | >= 346.46 |
--If nvidia-driver == 410.48
is installed
--CUDA 10.0
, 9.2
, 9.1
... etc. can be installed, but CUDA11.0
cannot be installed. Please check in advance if the CUDA you are installing now is compatible with the driver.
By the way, I think about these things when I am in the following situation.
--When you can't or don't want to change the version of nvidia-driver
--When working with Google colab
--When installing CUDA additionally on a machine that has already built the environment
If you operate nvidia-driver
poorly, you will end up destroying the environment and reinstalling the OS. Tedious.
The reality of CUDA is in / usr/local
. These are / usr/local/cuda11-2
and/usr/local/cuda10-2
. However, programs such as python do not refer to them directly. Refer to a symbolic link called cuda
.
Console
hoge@hoge:/usr/local$ ls -la
drwxr-xr-x 12 root root 4096 October 15 10:10 .
drwxr-xr-x 13 root root 4096 October 15 10:10 ..
~~~
lrwxrwxrwx 1 root root 9 October 15 10:10 cuda -> cuda-11.2
drwxr-xr-x 16 root root 4096 December 31 23:59 cuda-11-2
drwxr-xr-x 16 root root 4096 October 15 10:10 cuda-10-2
~~~
In the above situation, you can see that referencing the cuda
directory is equivalent to referencing the cuda-11-2
. If you want to change to cuda10-2
, re-paste the link to cuda
with the ln -nfs cuda-10-2 cuda
command. By doing this, you can manage and operate multiple versions of CUDA.
As an aside, a library called cudnn
is located in /usr/include/cudnn.h
. If you want to check these versions, you can check the versions by typing:
cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2
cudnn depends on the version of CUDA. So if you change the version of CUDA, you need to uninstall the cudnn and then install the appropriate version.
Recommended Posts