#!/bin/bash # Perform apt installs for bazel dependencies sudo apt-get install build-essential openjdk-8-jdk python-dev zip unzip -y # Tensorflow dependencies sudo apt-get install python-numpy python-scipy python-pip python-wheel -y sudo apt-get install python-enum32 python-mock python-h5py -y sudo apt-get install python3-dev python3-numpy python3-scipy python3-pip python3-wheel -y sudo apt-get install python3-mock python3-h5py -y # mlocate will be used to locate libraries needed by TF sudo apt-get install mlocate -y sudo updatedb # TF > 1.10 version requires keras libraries be present for the build pip install keras_applications==1.0.4 --no-deps pip install keras_preprocessing==1.0.2 --no-deps pip3 install keras_applications==1.0.4 --no-deps pip3 install keras_preprocessing==1.0.2 --no-deps pip3 install enum34 # Build the deviceQuery script to allow us to pull out device information cuda_location=/usr/local/cuda cd $cuda_location/samples/1_Utilities/deviceQuery sudo make -s # Go out and get bazel wget --no-check-certificate https://github.com/bazelbuild/bazel/releases/download/0.15.0/bazel-0.15.0-dist.zip # unzip the bazel unzip bazel-0.15.0-dist.zip -d bazel_build cd bazel_build ./compile.sh # Move bazel out to the main directory mv output/bazel ../bazel # clear up needed space cd .. rm -rf bazel_build rm -rf bazel-0.15.2-dist.zip # Bazel is done, next we need tensorflow git clone --single-branch -b v1.12.0 https://github.com/tensorflow/tensorflow # Prepare the environment, helperscript automagically looks through the device # and finds the libraries and CUDA information to pass to TF source ./helperscript # make sure tensorflow knows bazel exists export PATH="$PATH:$(`pwd`)" # configure the build of tensorflow bash ./tensorflow/configure # Move into Tensorflow and build it.... YAY cd tensorflow git apply ../tf_1.12.0_patch.patch ../bazel build --config=opt --config=cuda --config=monolithic //tensorflow/tools/pip_package:build_pip_package ../bazel build --config=opt --config=cuda --config=monolithic //tensorflow:libtensorflow_cc.so