Installing Tensorflow with GPU support on Ubuntu 16.04 - rdjondo/TensorFlowGPUonUbuntu GitHub Wiki
Installing Docker for running learning resources (e.g. Udacity MOOC)
-
Head to the Docker installation webpage and install Docker https://docs.docker.com/engine/installation/linux/ubuntulinux/
-
If you have a large second HDD, you might want to make sure all the docker images you use are stored on the large disk to preserve your precious SSD space. For this, I found that creating a symbolic link to a new location on the second hard-drive disk worked best for me.
a. Make sure that the large hard drive disk is mounted automatically when booting the disk https://help.ubuntu.com/community/Fstab
b. Setup a symbolic link to a directory inside your large hard drive disk. Setting DOCKER_OPTS did not work for me, but the symbolic link method worked: https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169
Installing Python Anaconda
-
Follow the instructions here https://www.continuum.io/downloads
-
Download this python script (It will update the PIP libraries useful to download and easily install Tensorflow later-on) https://bootstrap.pypa.io/ez_setup.py
-
Run the script in a Bash Terminal "python ez_setup.py "
Installing the GPU computing libraries
-
Install CUDA 8.0 following these instructions http://askubuntu.com/questions/799184/how-can-i-install-cuda-on-ubuntu-16-04
-
At the end of the process run the command "ls /usr/local/cuda/" to check that the installation has been successfully completed. You should see the following directories: "include" and "lib64"
-
Restart your machine
-
To install the NVIDIA CuDNN v5 library follow these instructions (it is mostly about creating an NVIDIA dev account, downloading an archive and copying the files inside ls /usr/local/cuda/"): http://askubuntu.com/questions/767269/how-can-i-install-cudnn-on-ubuntu-16-04
-
Add the libraries to your environment variable PATH by adding at the end of the ".bashrc" file:
Added support for CUDA and CUDnn (NVIDIA GPU-accelerated library of primitives for deep neural networks)
LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" export CUDA_HOME="/usr/local/cuda" export LD_LIBRARY_PATH export PATH="$LD_LIBRARY_PATH:$PATH"
Installing Tensorflow with GPU support
To install Tensorflow, run the following:
# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-linux_x86_64.whl
$ sudo pip install --upgrade $TF_BINARY_URL
To test your installation of Tensorflow, run the following in a Bash Terminal
$ python
...
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
> Hello, TensorFlow!
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))
> 42