Useful links:
Make sure you have a Nvidia GPU that supports CUDA. You can do it by running these:
update-pciids
- updates the description of the hardwarelspci | grep -i nvidia
- find all nvidia hardware you have- Check if you model has the CUDA support by searching for it here
Check your linux version by running uname -m && cat /etc/*release
Verify you have gcc installed by running gcc --version
Check your kernel version and update kernel headers:
uname -r
sudo apt-get install linux-headers-$(uname -r)
Install CUDA and drivers:
- Go to CUDA download page
- Download all the files
- Install all packages in the historical order by running
sudo dpkg -i <package_file>
- Run
sudo apt-get update
- Run
sudo apt-get install cuda-9-0
as your last step - Make sure you have installed CUDA 9.0 and not CUDA 9.1 by running
nvcc --version
- If you've installed 9.1 then remove it by running
sudo apt-get remove cuda
and runsudo apt-get install cuda-9-0
Install cuDNN:
- Go to cuDNN download page
- If you have an account then log in or sign up
- Download the deb runtime package
- install it by running
sudo dpkg -i <package_file>
Install Tensorflow 1.6 with GPU support. There are two ways of installing it:
-
By installing from the direct link
- Go to this section of the official Tensorflow installation guide and choose your link, copy it
- Run
pip install --ignore-installed --upgrade <copied_link>
-
By using official pip repo
- Run
pip install tensorflow-gpu
- Run
Verify the installation.
Run python
and use this little program to see if the installation is correct
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
You should see b'Hello, TensorFlow!'
written in the console