Skip to content

Instantly share code, notes, and snippets.

@bexcite
Forked from erikbern/install-tensorflow.sh
Created October 31, 2016 21:58
Show Gist options
  • Save bexcite/7f55dae6cbe40fc93adb51b8f124f231 to your computer and use it in GitHub Desktop.
Save bexcite/7f55dae6cbe40fc93adb51b8f124f231 to your computer and use it in GitHub Desktop.
Installing TensorFlow on EC2
# This is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
sudo apt-get upgrade -y # choose “install package maintainers version”
sudo apt-get install -y build-essential python-pip python-dev git # same
# Blacklist Noveau which has some kind of conflict with the nvidia driver
echo -e "blacklist nouveau\nblacklist lbm-nouveau\noptions nouveau modeset=0\nalias nouveau off\nalias lbm-nouveau off\n" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
sudo reboot # Reboot (annoying you have to do this in 2015!)
# Some other annoying thing we have to do
sudo apt-get install -y linux-image-extra-virtual
sudo reboot # Not sure why this is needed
# Install latest Linux headers
sudo apt-get install -y linux-source linux-headers-`uname -r`
# Install CUDA 7.0
wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run
chmod +x cuda_7.0.28_linux.run
./cuda_7.0.28_linux.run -extract=`pwd`/nvidia_installers
cd nvidia_installers
sudo ./NVIDIA-Linux-x86_64-346.46.run
sudo modprobe nvidia
sudo ./cuda-linux64-rel-7.0.28-19326674.run
cd
# Install tensorflow
sudo pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda
# Clone source as well (for examples)
git clone https://github.com/tensorflow/tensorflow
cd tensorflow/tensorflow/models/image/mnist
python convolutional.py
# At this point, it breaks down. It works, but doesn't use the GPU. On g2.2xlarge:
# I tensorflow/core/common_runtime/gpu/gpu_device.cc:611] Ignoring gpu device (device: 0, name: GRID K520, pci bus id: 0000:00:03.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
# On g2.8xlarge:
# I tensorflow/core/common_runtime/gpu/gpu_device.cc:611] Ignoring gpu device (device: 0, name: GRID K520, pci bus id: 0000:00:03.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
# I tensorflow/core/common_runtime/gpu/gpu_device.cc:611] Ignoring gpu device (device: 1, name: GRID K520, pci bus id: 0000:00:04.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
# I tensorflow/core/common_runtime/gpu/gpu_device.cc:611] Ignoring gpu device (device: 2, name: GRID K520, pci bus id: 0000:00:05.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
# I tensorflow/core/common_runtime/gpu/gpu_device.cc:611] Ignoring gpu device (device: 3, name: GRID K520, pci bus id: 0000:00:06.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
# TODO: Seems like there's a discussion on GitHub about CUDA 3.0 support
# https://github.com/tensorflow/tensorflow/issues/25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment