This topic shows steps to install NVIDIA driver and Cuda toolkit on Ubuntu.
My card GT630 is old then I have to use Ubuntu 16.04 that have gcc 5 and linux kernel 4. However, the steps are same for newer card and kernel. You must check cuda version before selecting suitable linux version for your card.
1. Preparation
- Hardware: PC with NVidia Card, GT630 is used in this series (driver 384, cuda 8.0 GA2, gcc 5)
- OS: Ubuntu 16.04
2. Remove existing driver
sudo apt-get remove --purge nvidia*
sudo apt-get remove --purge "nvidia*"
3. Install driver
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
ubuntu-drivers devices
sudo apt install -y nvidia-384 libxmu-dev freeglut3-dev libx11-dev libglu1-mesa libglu1-mesa-dev libfreeimage-dev
sudo reboot
4. Reboot and check
sudo reboot
nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.130 Driver Version: 384.130 |
|-------------------------------+----------------------+----------------------+
| 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 GT 630 Off | 00000000:03:00.0 N/A | N/A |
| 40% 39C P0 N/A / N/A | 0MiB / 1985MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 Not Supported |
+-----------------------------------------------------------------------------+
5. Download Cuda and patches
mkdir v8.0_ga2
cd v8.0_ga2
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/patches/2/cuda_8.0.61.2_linux-run
6. Extract packages
chmod +x cuda_8.0.61_375.26_linux-run
chmod +x cuda_8.0.61.2_linux-run
mkdir extract
./cuda_8.0.61_375.26_linux-run --extract=$(pwd)/extract
7. Install Cuda only
sudo ./extract/cuda-linux64-rel-8.0.61-21551265.run -noprompt
sudo ./cuda_8.0.61.2_linux-run --silent --accept-eula
sudo /bin/bash -c 'echo PATH=\"\$PATH:/usr/local/cuda/bin\" >> /etc/profile'
sudo /bin/bash -c 'echo "/usr/local/cuda/lib64" >> /etc/ld.so.conf'
sudo ldconfig
8. Reboot and check
sudo reboot
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
9. Install CuDNN
Go to this link to download CuDNN https://developer.nvidia.com/cudnn, version should >= 7.0
Install to system
sudo dpkg -i cudnn/libcudnn7_7.1.4.18-1+cuda8.0_amd64.deb
sudo dpkg -i cudnn/libcudnn7-dev_7.1.4.18-1+cuda8.0_amd64.deb
sudo dpkg -i cudnn/libcudnn7-doc_7.1.4.18-1+cuda8.0_amd64.deb
Check version
cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2
#define CUDNN_MAJOR 7
#define CUDNN_MINOR 1
#define CUDNN_PATCHLEVEL 4
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
#include "driver_types.h"
Leave a Reply