This document describes how to install the combination of 14.04 + CUDA 7.5 + Tensorflow. This combination is the easiest to install without anything like compilation from sources etc.
This way below installs CUDA and all the related things (e.g. drivers needed).
- Go to https://developer.nvidia.com/cuda-downloads
- Choose Linux -> x86_64 -> Ubuntu -> 14.04 or 16.04 -> deb (local)
- Press download
After download is over, open a terminal and navigate to Downloads
.
wget https://s3.amazonaws.com/workspace.insightzen.com/bins/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda
the dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb
might differ (check the download name - or use tab for autocomplete)
Restart the PC to activate CUDA + the new drivers.
CUDNN makes CNNs faster with some convolutional and other optimizations.
Navigate to https://developer.nvidia.com/cudnn and register for an account (it's free). After you make your account, login and go to downloads.
Choose the following
Download cuDNN v5.1 (August 10, 2016), for CUDA 8
cuDNN v5.1 Library for Linux
after it is downloaded navigate to Downloads
and extract the tar file. You will get a folder called cuda
.
Open a terminal and run the following to navigate to this folder and put the cudnn files to your system folders.
wget https://s3.amazonaws.com/workspace.insightzen.com/bins/cudnn-8.0-linux-x64-v5.1.tgz
tar xvzf cudnn-8.0-linux-x64-v5.1.tgz
cd cuda
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/cudnn.h /usr/local/cuda/include/
Open .bashrc
from your home folder with an editor (the dot indicates that it is a hidden file).
a way to do this for example is
vim ~/.bashrc
Add the following lines to the end of the file.
# add cuda tools to command path
export PATH=/usr/local/cuda/bin:${PATH}
export MANPATH=/usr/local/cuda/man:${MANPATH}
# add cuda libraries to library path
if [[ "${LD_LIBRARY_PATH}" != "" ]]
then
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
else
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
fi
You need to log out and log back in after this step.
wget https://repo.continuum.io/archive/Anaconda3-4.4.0-Linux-x86_64.sh
bash Anaconda3-4.4.0-Linux-x86_64.sh
conda create -n tensorflow
source activate tensorflow
pip install --ignore-installed --upgrade tfBinaryURL
where tfBinaryURL is the URL of the TensorFlow Python package. For example, the following command installs the GPU version of TensorFlow for Python 3.6:
(tensorflow)$ pip install --ignore-installed --upgrade \
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.0-cp36-cp36m-linux_x86_64.whl
https://ulrik.is/writing/cuda-8-0-cudnn-5-tensorflow-1-0-and-keras-on-windows-10/
Reference :