Some useful commands for my personal use, but feel free to try them*:
installing ‘Nvidia’ Display driver
#Check if the graphics card supports the NVidia drivers:$ lspci | grep -i nvidia
#The video driver information:$ lshw -c video
* Be careful, the next lines are going to remove your current graphic card driver and if your graphic card supports it, it installs the Nvidia driver instead:
$ To install the display drivers, first log out from GUI. Go to a terminal session (ctrl+alt+F2). Then remove the open-source Nouveau drivers:$ sudo apt-get purge xserver-xorg-video-nouveau
#Removing NVidia drivers:$ sudo apt purge nvidia*
$ sudo apt-get autoremove
$ sudo apt-get upgrade && sudo apt-get update -y
#List of available drivers:$ sudo ubuntu-drivers devices
#Install the appropriate NVidia driver from the above list. But more importantly, you need to be sure first what version of the driver is compatible with your Ubuntu and your device. For checking that you may use the official Nvidia website at https://www.nvidia.com/Download/index.aspx.
For example:$ sudo apt-get install nvidia-387
#check if drivers were installednvidia-smi
# The above command should bring a chart similar to the following image:
* I disabled the ‘secure booting’ to avoid loop after login Ubuntu (it can be done by something like:)
$ sudo apt install mokutil $ sudo mokutil --disable-validation
installing Cuda | NVIDIA Developer
# For Installing CUDA 9.1, follow the instruction on the official website.
* To not load NVidia drivers if the open-source Nouveau drivers are installed and loaded:$ sudo nano /usr/lib/modprobe.d/blacklist-nouveau.conf
and add these two lines to ‘blacklist-nouveau.conf’:blacklist nouveau
options nouveau modeset=0
* Download the ‘.deb’ file instead of ‘.run’
* Always check the latest version (currently 9.1 in Feb 2018).
# After installation, check if the Cuda was installed correctly by:$ nvcc -V
# If the above command says “NVCC: No such file or directory” then update the PATH that includes the ‘bin’; mine was like:$ export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}
# Then update the ‘bash’:
source ~/.bashrc
# Also check if the device with installed CUDA communicates correctly. First, find the executable ‘bandwidthTest’:$ find / -type f -name bandwidthTest
# Mine was at /usr/local/cuda-8.0/extras/demo_suite, run it and see if works:$ ./bandwidthTest
More information at NVIDIA official web page
installing CudNN
# First it should be downloaded from the NVIDIA website after creating an account there. I used the Debian file versions and downloaded the following three items:
cuDNN v7.0.5 Runtime Library for Ubuntu16.04 (Deb)
cuDNN v7.0.5 Developer Library for Ubuntu16.04 (Deb)
cuDNN v7.0.5 Code Samples and User Guide for Ubuntu16.04 (Deb)
# Then, navigate to the <cudnnpath> directory containing cuDNN Debian file and install the runtime library, for example:
$ sudo dpkg -i libcudnn7_7.0.5.11-1+cuda9.1_amd64.deb
# Next, install the developer library, for example:
$ sudo dpkg -i libcudnn7-dev_7.0.5.11-1+cuda9.1_amd64.deb
Finally, install the code samples and the cuDNN Library User Guide, for example:
$ sudo dpkg -i libcudnn7-doc_7.0.5.11-1+cuda9.1_amd64.deb
* Be careful about the versions (e.g. cuda9.1
and cuDNN v7.0.5
)
Some additional tips:
Cheatsheet:
# find a file with the name ‘BlahBlah’:$ find / -type f -name BlahBlah
* Be careful! codes may cause some problems, especially for your graphic card. Use on your own responsibilities.