Skip to content

Instantly share code, notes, and snippets.

@timguoqk
Forked from dennybritz/tf8_aws.sh
Last active February 8, 2017 06:46
Show Gist options
  • Select an option

  • Save timguoqk/29a0debbdb7e6bb119579dbd15ee849a to your computer and use it in GitHub Desktop.

Select an option

Save timguoqk/29a0debbdb7e6bb119579dbd15ee849a to your computer and use it in GitHub Desktop.
Tensorflow 0.12 on AWS GPU instance installation
# Install build tools
sudo apt-get update
sudo apt-get install -y build-essential git python-pip libfreetype6-dev libxft-dev libncurses-dev libopenblas-dev gfortran python3-matplotlib libblas-dev liblapack-dev libatlas-base-dev python3-dev python3-pydot linux-headers-generic linux-image-extra-virtual unzip python3-numpy swig python3-pandas python-sklearn unzip python3-pip python3-venv
# Install CUDA 8
wget https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb
sudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb && rm cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb
sudo apt-get update
sudo apt-get install -y cuda
# Install cuDNN
# You get the CUDNN_URL by logging into your nivida account and downloading cuDNN
# https://developer.nvidia.com/rdp/cudnn-download
# Copy the file to ~/cudnn-8.0-linux-x64-v5.1.tgz
tar -zxf cudnn-8.0-linux-x64-v5.1.tgz && rm cudnn-8.0-linux-x64-v5.1.tgz
sudo cp ./cuda/lib64/* /usr/local/cuda/lib64/
sudo cp ./cuda/include/* /usr/local/cuda/include/
# Reboot for CUDA
sudo reboot
# Create virtualenv
pyvenv-3.5 ~/tf
source ~/tf/bin/activate
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-linux_x86_64.whl
pip install -U pip
pip install -U $TF_BINARY_URL
pip install jupyter ipython numpy pandas scikit-learn
# Set CUDA env vars
export CUDA_HOME=/usr/local/cuda
export CUDA_ROOT=$CUDA_HOME
export PATH=$PATH:$CUDA_ROOT/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_ROOT/lib64:$CUDA_ROOT/extras/CUPTI/lib64
@timguoqk
Copy link
Author

This script works on p2.xlarge running Ubuntu 16.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment