Installing CUDA 10.2 and RTX NVidia drivers on Ubuntu 18.04 LTS
I wanted install the NVidia Geforce drivers and CUDA development environment on fresh Ubuntu 18.04 installation. The target machine is an HP Z820 with a Geforce RTX 2060 super card.
This assumes you want to write C code when building applicatoins for GPUs The Numba Installation Instructions say you only need the GPU drivers if you all your GPU programming is going to be done in Python.
Alternative instructions Nvidia Cuda Installation Guide
This assumes you want to write C code when building applicatoins for GPUs The Numba Installation Instructions say you only need the GPU drivers if you all your GPU programming is going to be done in Python.
What didn't work
Enabling proprietary drivers on installation did not work out of the box.
The out of the box install left my login process broken. The screen would turn black and a cursor would appear and then would cycle back to the login screen. The problem was the display driver/windows system crashed and then restarted back at login. I was able to fix it by uninstalling the driver or doing an upgrade.
The out of the box install left my login process broken. The screen would turn black and a cursor would appear and then would cycle back to the login screen. The problem was the display driver/windows system crashed and then restarted back at login. I was able to fix it by uninstalling the driver or doing an upgrade.
Assumptions
NVIDIA drivers are not installed. You should remove the drivers and reboot before proceeding if the drivers are loaded. Instructions exist on the internet.
Install CUDA and graphics drivers
Step | Action |
---|---|
Update the System | |
Open terminal | Open a terminal |
Update | sudo apt-get update sudo apt-get upgrade |
Install CUDA toolkit | |
Visit NVIDIA | Nvidia CUDA 10.2 Instructions Choose the following to get these instructions
|
Open Terminal | open a terminal window |
Add Config Repository |
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 sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" sudo apt-get update |
Install CUDA | sudo apt-get -y install cuda |
Add CUDA toolkit to path | |
Edit profile | vi ~/.profile |
Add to path | # set PATH for cuda installation if [ -d "/usr/local/cuda/bin/" ]; then export PATH=/usr/local/cuda/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} fi |
Verify after Reboot | |
Reboot | sudo reboot |
Verify | nvidia-smi |
Verify | nvcc --version |
Alternative instructions Nvidia Cuda Installation Guide
Sample nvidia-smi output
$ nvidia-smi
Mon Mar 16 21:37:50 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64.00 Driver Version: 440.64.00 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 206... On | 00000000:05:00.0 Off | N/A |
| 41% 28C P8 5W / 175W | 173MiB / 7981MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1365 G /usr/lib/xorg/Xorg 75MiB |
| 0 1426 G /usr/bin/gnome-shell 96MiB |
+-----------------------------------------------------------------------------+
Uninstall
Something like one of these
- sudo apt-get --purge remove cuda
- sudo apt-get --purge remove cuda-x.y
Change log
Created 2020 03
Comments
Post a Comment