Skip to content

Instantly share code, notes, and snippets.

@nathanielatom
Created July 8, 2016 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanielatom/ccdf39d9f20dca4c9e418ea0e00ccd25 to your computer and use it in GitHub Desktop.
Save nathanielatom/ccdf39d9f20dca4c9e418ea0e00ccd25 to your computer and use it in GitHub Desktop.
Pseudo-script (meant to be read and executed line by line) for installing Tensorflow with GPU support on linux.
# Tensorflow 0.9 with GPU from binary for ubuntu linux 64 bit. Assumes anaconda python 2 is already installed.
cd ~
conda update conda
conda update anaconda
# update environment variables
echo 'export CUDA_HOME="/usr/local/cuda"' >> setup-env.sh
echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64"' >> setup-env.sh
echo 'export PATH="$CUDA_HOME/bin:$PATH"' >> setup-env.sh
sudo cp setup-env.sh /etc/profile.d/
rm setup-env.sh
# you need to have an updated nvidia driver for your card
# use http://www.nvidia.com/Download/Find.aspx to find driver
export DRIVER_URL="<URL for driver file download.run>"
wget $DRIVER_URL -O NVIDIA-Linux-x86_64-my-driver.run
chmod +x NVIDIA-Linux-x86_64-my-driver.run
sudo ./NVIDIA-Linux-x86_64-my-driver.run
sudo modprobe nvidia
sudo reboot
nvidia-smi -q
# use https://developer.nvidia.com/cuda-toolkit-70 to find appropriate cuda installer
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.0-28_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_7.0-28_amd64.deb
sudo apt-get update -y # should update to cuda 7.5
# Get cuDNN 4 for Linux, requires an account:
# https://developer.nvidia.com/rdp/cudnn-download
export CUDNN_URL="<URL for file download, after signing in>"
wget $CUDNN_URL -O cudnn-7.5-linux-x64-v4.tgz
tar xvzf cudnn-7.5-linux-x64-v4.tgz
sudo cp cudnn-7.5-linux-x64-v4/cudnn.h /usr/local/cuda/include
sudo cp cudnn-7.5-linux-x64-v4/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
# test cuda
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
sudo ./deviceQuery # ensure cuda 7.5, and take note of compute capability
cd ~
# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 7.5 and CuDNN v4. For other versions, see "Install from sources".
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
pip install --upgrade $TF_BINARY_URL
rm -rf NVIDIA-Linux-x86_64-my-driver.run cuda-repo-ubuntu1404_7.0-28_amd64.deb cudnn-7.5-linux-x64-v4.tgz cudnn-7.5-linux-x64-v4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment