Skip to content

Instantly share code, notes, and snippets.

@Hello1024
Last active May 19, 2020 22:55
Show Gist options
  • Save Hello1024/bfbcb4616aadee62c68e to your computer and use it in GitHub Desktop.
Save Hello1024/bfbcb4616aadee62c68e to your computer and use it in GitHub Desktop.

Revisions

  1. Hello1024 revised this gist Nov 12, 2015. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions set_up_aws_tensorflow.sh
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@
    # 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
    @@ -37,8 +39,8 @@ CUDNN_INSTALL_PATH="/usr/local/cuda-6.5"
    EOF
    (cd third_party/gpus/cuda; ./cuda_config.sh;)

    # test a build (remove --jobs 1 if you have lots of ram and like speed)
    bazel build --jobs 1 -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
    # 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
  2. Hello1024 revised this gist Nov 12, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion set_up_aws_tensorflow.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    #!/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

    cd ~

    # grab cuda 7.0
    @@ -38,5 +41,7 @@ EOF
    bazel build --jobs 1 -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

  3. Hello1024 created this gist Nov 12, 2015.
    42 changes: 42 additions & 0 deletions set_up_aws_tensorflow.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    #!/bin/bash

    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 (remove --jobs 1 if you have lots of ram and like speed)
    bazel build --jobs 1 -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

    # Build and install the python stuff