Skip to content

Instantly share code, notes, and snippets.

@nix010
Forked from trungkak/tf.sh
Last active November 24, 2017 04:04
Show Gist options
  • Save nix010/732dca72f2d77f19c4f7ffb0a6d90b1c to your computer and use it in GitHub Desktop.
Save nix010/732dca72f2d77f19c4f7ffb0a6d90b1c to your computer and use it in GitHub Desktop.
Tensorflow GPU installation on Ubuntu 16.04
# 1. Install CUDA
# Preparation
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install tmux build-essential gcc g++ make binutils
sudo apt-get install software-properties-common
# Download Cuda toolkit (Nvidia driver included)
cd ~/Downloads
# Download CUDA 8.0 from this https://developer.nvidia.com/cuda-80-ga2-download-archive, not 9.0
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
# Installation
sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
sudo apt-get update
sudo apt-get -y install cuda-8-0
# Add these line to the end of bashrc
export CUDA_HOME="/usr/local/cuda/"
export PATH="$PATH:$CUDA_HOME/bin"
source ~/.bashrc
# Reboot then check the installation
nvidia-smi
nvcc --version
# 2. Install CuDNN
wget https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/8.0_20170307/cudnn-8.0-linux-x64-v6.0-tgz
tar -zxvf cudnn-8.0-linux-x64-v6.0.tgz
cd cuda/lib64/
sudo cp libcudnn.so.6.0.21 libcudnn_static.a /usr/local/cuda/lib64
# Make symbolic link
cd /usr/local/cuda/lib64/
sudo ln -s libcudnn.so.6.0.21 libcudnn.so.6
sudo ln -s libcudnn.so.6 libcudnn.so
cd ~/Downloads/cuda/include
sudo cp cudnn.h /usr/local/cuda/include/
export LD_LIBRARY_PATH=/usr/local/cuda/lib64/
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64/
# 3. Install tensorflow from https://www.tensorflow.org/install/install_linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment