Last active
December 20, 2017 01:36
-
-
Save bennuttall/634a83631f8963c1f4e1cb1a3ce59c6e to your computer and use it in GitHub Desktop.
Script to build tensorflow on a Raspberry Pi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# instructions scripted from https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md | |
apt update | |
apt -y upgrade | |
apt -y install pkg-config zip g++ zlib1g-dev unzip python-pip python-numpy swig python-dev python3-pip \ | |
python3-numpy python3-dev oracle-java8-jdk | |
# bazel | |
wget https://github.com/bazelbuild/bazel/releases/download/0.9.0/bazel-0.9.0-dist.zip -O bazel.zip | |
unzip -d bazel bazel.zip | |
cd bazel | |
sed -i 's/-encoding UTF-8 "@${paramfile}"/-encoding UTF-8 "@${paramfile} -J-Xmx500M"/g' scripts/bootstrap/compile.sh | |
./compile.sh | |
cp output/bazel /usr/local/bin/bazel | |
# tensorflow | |
su piwheels | |
cd ~ | |
git clone --recurse-submodules https://github.com/tensorflow/tensorflow.git | |
cd tensorflow | |
git checkout v1.4.1 | |
grep -Rl 'lib64' | xargs sed -i 's/lib64/lib/g' | |
sed -i 's/f3a22f35b044/d781c1de9834/g' tensorflow/workspace.bzl | |
sed -i 's/ca7beac153d4059c02c8fc59816c82d54ea47fe58365e8aded4082ded0b820c4/a34b208da6ec18fa8da963369e166e4a368612c14d956dd2f9d7072904675d9b/g' tensorflow/workspace.bzl | |
./configure | |
bazel build -c opt --copt="-mfpu=neon-vfpv4" --copt="-funsafe-math-optimizations" --copt="-ftree-vectorize" --copt="-fomit-frame-pointer" --local_resources 1024,1.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package | |
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment