ubuntu 18.04.2 CUDA® Toolkit installation use cuda-repo-ubuntu1804-10-1-local-10.1.168-418.67_1.0-1_amd64.deb

Before install tensorflow, I follow https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html to install the toolkit.

Initially, i use ppa:graphics-drivers to install the gpu driver (nvidia-driver-430) first. Everything seems ok as shown below. But, The software & updates of ubuntu show : using alternative driver; using nvidia-driver-430(open source).

Downloads$ nvidia-smi
Wed Jul 31 11:08:30 2019
| NVIDIA-SMI 430.26 Driver Version: 430.26 CUDA Version: 10.2 |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| 0 GeForce RTX 208… Off | 00000000:0A:00.0 On | N/A |
| 5% 54C P8 9W / 250W | 486MiB / 11016MiB | 3% Default |

| Processes: GPU Memory |
| GPU PID Type Process name Usage |
| 0 1461 G /usr/lib/xorg/Xorg 18MiB |
| 0 1519 G /usr/bin/gnome-shell 58MiB |
| 0 2496 G /usr/lib/xorg/Xorg 163MiB |
| 0 2654 G /usr/bin/gnome-shell 134MiB |
| 0 4010 G /opt/teamviewer/tv_bin/TeamViewer 22MiB |
| 0 5498 G …uest-channel-token=10951697630719337704 86MiB |

then, I install toolkit

download cuda-repo-ubuntu1804-10-1-local-10.1.168-418.67_1.0-1_amd64.deb

$ sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.168-418.67_1.0-1_amd64.deb

$ sudo apt-key add /var/cuda-repo-10-1-local-10.1.168-418.67/7fa2af80.pub

pub   rsa4096 2016-06-24 [SC]
      AE09 FE4B BD22 3A84 B2CC  FCE3 F60F 4B3D 7FA2 AF80
uid           [ unknown] cudatools <cudatools@nvidia.com>

$ sudo apt-get update

step 4:
$ sudo apt-get install cuda

step 5 post-installation

export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.3${PATH:+:${PATH}}

step 6 verify the installation is ok
nvidia-persistenced is running
cat /proc/driver/nvidia/version shows gcc 7.4, gpu driver 430
after cuda-install-samples-10.1.sh install. make is ok. all samples could run. deviceQuery, etc all ok.

Then I saw

So, I worry nvidia-driver-430 is not from nvidia (?), It might cause problems for tensorflow.

so, I remove repository ppa:graphics-drivers and reinstall cuda drivers. It takes a few tries.


sudo apt-get install cuda-drivers
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
cuda-command-line-tools-10-1 cuda-compiler-10-1 cuda-cudart-dev-10-1 cuda-cufft-dev-10-1 cuda-cuobjdump-10-1 cuda-cupti-10-1
cuda-curand-dev-10-1 cuda-cusolver-dev-10-1 cuda-cusparse-dev-10-1 cuda-documentation-10-1 cuda-driver-dev-10-1 cuda-gdb-10-1
cuda-gpu-library-advisor-10-1 cuda-libraries-dev-10-1 cuda-memcheck-10-1 cuda-misc-headers-10-1 cuda-npp-dev-10-1 cuda-nsight-10-1
cuda-nsight-compute-10-1 cuda-nsight-systems-10-1 cuda-nvcc-10-1 cuda-nvdisasm-10-1 cuda-nvgraph-dev-10-1 cuda-nvjpeg-dev-10-1
cuda-nvml-dev-10-1 cuda-nvprof-10-1 cuda-nvprune-10-1 cuda-nvrtc-dev-10-1 cuda-nvtx-10-1 cuda-nvvp-10-1 cuda-samples-10-1
cuda-sanitizer-api-10-1 cuda-toolkit-10-1 cuda-tools-10-1 cuda-visual-tools-10-1 libcublas-dev
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
Recommended packages:
libnvidia-compute-418:i386 libnvidia-decode-418:i386 libnvidia-encode-418:i386 libnvidia-ifr1-418:i386 libnvidia-fbc1-418:i386
The following NEW packages will be installed:
cuda-drivers nvidia-driver-418
0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.
Need to get 0 B/403 kB of archives.
After this operation, 1,130 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Get:1 file:/var/cuda-repo-10-1-local-10.1.168-418.67 nvidia-driver-418 418.67-0ubuntu1 [400 kB]
Get:2 file:/var/cuda-repo-10-1-local-10.1.168-418.67 cuda-drivers 418.67-1 [2,560 B]

Selecting previously unselected package nvidia-driver-418.
(Reading database … 186585 files and directories currently installed.)
Preparing to unpack …/nvidia-driver-418_418.67-0ubuntu1_amd64.deb …
Unpacking nvidia-driver-418 (418.67-0ubuntu1) …
Selecting previously unselected package cuda-drivers.
Preparing to unpack …/cuda-drivers_418.67-1_amd64.deb …
Unpacking cuda-drivers (418.67-1) …
Setting up nvidia-driver-418 (418.67-0ubuntu1) …
Setting up cuda-drivers (418.67-1) …

notice there are two deb for gpu-driver 418.67 from nvidia toolkit. The source of it is shown below.

$ dpkg -s nvidia-driver-418
Package: nvidia-driver-418
Status: install ok installed
Priority: optional
Section: non-free/libs
Installed-Size: 1097
Maintainer: Ubuntu Core Developers ubuntu-devel-discuss@lists.ubuntu.com
Architecture: amd64
Source: nvidia-graphics-drivers-418
Version: 418.67-0ubuntu1
Depends: libnvidia-gl-418 (= 418.67-0ubuntu1), nvidia-dkms-418 (= 418.67-0ubuntu1), nvidia-kernel-source-418 (= 418.67-0ubuntu1), libnvidia-compute-418 (= 418.67-0ubuntu1), nvidia-compute-utils-418 (= 418.67-0ubuntu1), libnvidia-decode-418 (= 418.67-0ubuntu1), libnvidia-encode-418 (= 418.67-0ubuntu1), nvidia-utils-418 (= 418.67-0ubuntu1), xserver-xorg-video-nvidia-418 (= 418.67-0ubuntu1), libnvidia-cfg1-418 (= 418.67-0ubuntu1), libnvidia-ifr1-418 (= 418.67-0ubuntu1), libnvidia-fbc1-418 (= 418.67-0ubuntu1)
Recommends: nvidia-settings, nvidia-prime (>= 0.8), libnvidia-compute-418:i386 (= 418.67-0ubuntu1), libnvidia-decode-418:i386 (= 418.67-0ubuntu1), libnvidia-encode-418:i386 (= 418.67-0ubuntu1), libnvidia-ifr1-418:i386 (= 418.67-0ubuntu1), libnvidia-fbc1-418:i386 (= 418.67-0ubuntu1), libnvidia-gl-418:i386 (= 418.67-0ubuntu1)
Description: NVIDIA driver metapackage
This metapackage depends on the NVIDIA binary driver and on all of its libraries,
to provide hardware acceleration for OpenGL/GLX/EGL/GLES/Vulkan
applications on either X11 or on Wayland.

$ dpkg -s cuda-drivers
Package: cuda-drivers
Status: install ok installed
Priority: optional
Section: multiverse/devel
Installed-Size: 7
Maintainer: cudatools cudatools@nvidia.com
Architecture: amd64
Version: 418.67-1
Depends: libnvidia-common-418 (>= 418.67), libnvidia-compute-418 (>= 418.67), libnvidia-decode-418 (>= 418.67), libnvidia-encode-418 (>= 418.67), libnvidia-fbc1-418 (>= 418.67), libnvidia-gl-418 (>= 418.67), libnvidia-ifr1-418 (>= 418.67), nvidia-compute-utils-418 (>= 418.67), nvidia-dkms-418 (>= 418.67), nvidia-driver-418 (>= 418.67), nvidia-kernel-common-418 (>= 418.67), nvidia-kernel-source-418 (>= 418.67), nvidia-utils-418 (>= 418.67), xserver-xorg-video-nvidia-418 (>= 418.67), nvidia-modprobe (>= 418.67), nvidia-settings (>= 418.67)
Description: CUDA Driver meta-package
Meta-package containing all the available packages related to the NVIDIA driver.

$ sudo apt-get install cuda
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
cuda-10-1 cuda-demo-suite-10-1 cuda-runtime-10-1
The following NEW packages will be installed:
cuda cuda-10-1 cuda-demo-suite-10-1 cuda-runtime-10-1
0 upgraded, 4 newly installed, 0 to remove and 7 not upgraded.
Need to get 0 B/3,859 kB of archives.
After this operation, 11.2 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 file:/var/cuda-repo-10-1-local-10.1.168-418.67 cuda-runtime-10-1 10.1.168-1 [2,530 B]
Get:2 file:/var/cuda-repo-10-1-local-10.1.168-418.67 cuda-demo-suite-10-1 10.1.168-1 [3,851 kB]
Get:3 file:/var/cuda-repo-10-1-local-10.1.168-418.67 cuda-10-1 10.1.168-1 [2,560 B]
Get:4 file:/var/cuda-repo-10-1-local-10.1.168-418.67 cuda 10.1.168-1 [2,512 B]
Selecting previously unselected package cuda-runtime-10-1.
(Reading database … 186645 files and directories currently installed.)
Preparing to unpack …/cuda-runtime-10-1_10.1.168-1_amd64.deb …
Unpacking cuda-runtime-10-1 (10.1.168-1) …
Selecting previously unselected package cuda-demo-suite-10-1.
Preparing to unpack …/cuda-demo-suite-10-1_10.1.168-1_amd64.deb …
Unpacking cuda-demo-suite-10-1 (10.1.168-1) …
Selecting previously unselected package cuda-10-1.
Preparing to unpack …/cuda-10-1_10.1.168-1_amd64.deb …
Unpacking cuda-10-1 (10.1.168-1) …
Selecting previously unselected package cuda.
Preparing to unpack …/./cuda_10.1.168-1_amd64.deb …
Unpacking cuda (10.1.168-1) …
Setting up cuda-runtime-10-1 (10.1.168-1) …
Setting up cuda-demo-suite-10-1 (10.1.168-1) …
Setting up cuda-10-1 (10.1.168-1) …
Setting up cuda (10.1.168-1) …

$ sudo apt-get install cuda
Reading package lists… Done
Building dependency tree
Reading state information… Done
cuda is already the newest version (10.1.168-1).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

Why there are two versions of the drivers? All the verification is ok, show nvidia driver and cuda samples are working.

Is it right? Are two drivers both needed? One is for the display as shown in the software & updates as open source; the other is for the cuda for computing using cuda cores.

If this installation is ok. I guess my previous installation with nvidia-driver-430 is working too. Is it?

nvidia-driver-430 version will have much more samples compiled and generated. I guess it will be more capable.

Please clarify things out.

“apt install cuda” installs the bundled nvidia (tesla) driver and cuda-toolkit thus overwriting your already installed driver 430. The more appropriate way is to install the driver from ppa and then just cuda-toolkit:
sudo apt install cuda-toolkit-10-1