Skip to content

Instantly share code, notes, and snippets.

@nobuf
Created May 5, 2016 23:23
Show Gist options
  • Save nobuf/6db4528ec7a38752e7c1316abbbbad9c to your computer and use it in GitHub Desktop.
Save nobuf/6db4528ec7a38752e7c1316abbbbad9c to your computer and use it in GitHub Desktop.
Install TensorFlow 0.8 GPU enabled on Ubuntu 14.04 EC2 g2.2xlarge
# you need to sign-up https://developer.nvidia.com/rdp/cudnn-download
scp cudnn-7.0-linux-x64-v4.0-prod.tgz ubuntu@your-ec2-instance:~/
ssh ubuntu@your-ec2-instance
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo apt-get update
# see http://tleyden.github.io/blog/2015/11/22/cuda-7-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
sudo apt-get install -y linux-image-extra-`uname -r` linux-headers-`uname -r` linux-image-`uname -r`
sudo apt-get install cuda
tar zxvf cudnn-7.0-linux-x64-v4.0-prod.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
# installing tensorflow
sudo apt-get install python-pip python-dev
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
git clone --recurse-submodules https://github.com/tensorflow/tensorflow
cat ~/.bashrc
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda
# With running the below command, I can see some messages about GPU...
# `I tensorflow/core/common_runtime/gpu/gpu_device.cc:755] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GRID K520, pci bus id: 0000:00:03.0)`
# It takes about 3 seconds on MacBook Pro 2.6 GHz Intel Core i5, so I was expecting it a lot faster.
# Apparently it takes about the same time... maybe the bottleneck is not something GPU can solve. I might be missing something though.
cd tensorflow/tensorflow/models/image/imagenet
time python classify_image.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment