Skip to content

Instantly share code, notes, and snippets.

@naishe
Forked from Hello1024/set_up_aws_tensorflow.sh
Created November 12, 2015 14:47
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 naishe/d6a08eb941b7cd2aae7e to your computer and use it in GitHub Desktop.
Save naishe/d6a08eb941b7cd2aae7e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Run this on This AMI on AWS:
# https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-b36981d8
# You should get yourself a fully working GPU enabled tensorflow installation.
cd ~
# grab cuda 7.0
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
# and sun java (for bazel)
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
# Get all the dependencies.
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
sudo apt-get -y install oracle-java8-installer pkg-config zip g++ zlib1g-dev unzip python-numpy swig python-dev cuda-command-line-tools-7-0 cuda-cublas-dev-7-0 cuda-cufft-dev-7-0 cuda-curand-dev-7-0
# Get and install bazel
git clone https://github.com/bazelbuild/bazel.git
cd bazel
git checkout tags/0.1.0
./compile.sh
export PATH=$PATH:`pwd`/output
cd ..
# Get, patch and install tensorflow
git clone --recurse-submodules https://github.com/tensorflow/tensorflow
cd tensorflow
curl http://pastebin.com/raw.php?i=WYJR3T1s > patch
patch -p1 <patch
cat > third_party/gpus/cuda/cuda.config <<EOF
CUDA_TOOLKIT_PATH="/usr/local/cuda-7.0"
CUDNN_INSTALL_PATH="/usr/local/cuda-6.5"
EOF
(cd third_party/gpus/cuda; ./cuda_config.sh;)
# test a build (add --jobs 1 if you hit OOM's)
bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
# Build and install the python stuff
bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/*.whl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment