Until recently, building TensorFlow at all on AArch64 was not possible due to its dependency on Bazel. Doing a bootstrap build of Bazel with its architecture-independent distribution archive failed. GitHub contributor, powderluv, has released several Bazel binaries allowing Google's instructions to work with a few caveats. Note: There are now a number of TensorFlow Docker containers for Arm but none of them are TensorFlow 2 or greater at the time of this writing.
_TF_MIN_BAZEL_VERSION = '2.0.0'
_TF_MAX_BAZEL_VERSION = '2.0.0'
ln -s bazel-1.2.1-aarch64-glibc-2.27 /usr/local/bin/bazel
bazel build //src:bazel
bazel build //src:bazel-dev
sudo ln -s /home/<user>/bazel-2.0.0/bazel-bin/src/bazel /usr/local/bin/bazel
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow && git pull
configure
yes "" | ./configure; python -c "import numpy as np"
pip install --upgrade setuptools && pip install future && pip install futures && pip install grpc
pip3 install --upgrade setuptools && pip3 install future
--config noaws
--local_ram_resources=1600
-local_cpu_resources=1
date; bazel build //tensorflow/tools/pip_package:build_pip_package --config noaws --config=monolithic --local_cpu_resources=4; date
If you have any interesting training scenarios, please contact me.[CTAToken URL = "https://community.arm.com/user/conversations#New=True" target="_blank" text="Contact Matt" class ="green"]We might be able to allocate compute resources and share our story at Arm DevSummit.
I came across following error:
(py3) pcl@begoit-920-11:~/packages/tensorflow$ date; bazel build //tensorflow/tools/pip_package:build_pip_package --config noaws --config=monolithic --local_cpu_resources=90; dateTue Nov 3 16:29:48 CST 20202020/11/03 16:29:48 Downloading releases.bazel.build/.../bazel-2.0.0-linux-arm64...2020/11/03 16:29:49 could not download Bazel: HTTP GET releases.bazel.build/.../bazel-2.0.0-linux-arm64 failed with error 404Tue Nov 3 16:29:49 CST 2020
Then, I found there is no ‘bazel-2.0.0-linux-arm64’ in releases.bazel.build/.../release
I'm using Ubuntu 20.10 on Raspberyy Pi 4 8Gb.
After installing Bazel 3.7.0 I set (https://github.com/bazelbuild/bazelisk):
export USE_BAZEL_VERSION=3.7.0
before running the bazel build.
When build finished:
(https://collaborate.linaro.org/display/BDTS/Building+and+Installing+Tensorflow+on+AArch64)
It worked splendidly for me - a bit worried about the 2.5.0 version though... but at least I succeeded to install and use.
Hope it helps.