This wiki explains how to build Tensorflow 1.13.1 for ARMv8 platform (aarch64 arm64)
Start a1.4xlarge instance with Ubuntu 16.04 OS and 64GB disk
sudo apt update
sudo apt upgrade
sudo reboot
sudo apt install build-essential
sudo apt install python3 python3-dev
sudo apt install pkg-config zip zlib1g-dev unzip curl tmux wget vim git htop
sudo apt install openjdk-8-jdk
sudo apt install liblapack3 libblas3 libhdf5-dev
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
sudo pip3 install six mock numpy grpcio
sudo pip3 install h5py==2.10.0
sudo pip3 install keras_applications --no-deps
sudo pip3 install keras_preprocessing --no-deps
wget https://github.com/bazelbuild/bazel/releases/download/0.19.2/bazel-0.19.2-dist.zip
mkdir bazel-0.19.2
unzip bazel-0.19.2-dist.zip -d bazel-0.19.2
cd bazel-0.19.2
# open tmux session
tmux
./compile.sh
# Copy bazel to $PATH
sudo cp output/bazel /usr/local/bin/
cd ..
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout v1.13.1
# run configure. It will ask several questions
# change python path to /usr/bin/python3
# hit enter for all other questions (default settings)
./configure
# Monolithic option will produce 90 MB wheel file. Without monolithic - 60MB
# --config=monolithic
# Make sure you are still in tmux session. Build will take about 1.5 hours
bazel build -c opt \
--copt=-O3 \
--copt=-std=c++11 \
--copt=-funsafe-math-optimizations \
--copt=-ftree-vectorize \
--copt=-fomit-frame-pointer \
--copt=-DRASPBERRY_PI \
--host_copt=-DRASPBERRY_PI \
--verbose_failures \
--config=noaws \
--config=nogcp \
--config=nohdfs \
--config=noignite \
--config=nokafka \
--config=nonccl \
//tensorflow/tools/pip_package:build_pip_package
# Build a universal wheel.
BDIST_OPTS="--universal" bazel-bin/tensorflow/tools/pip_package/build_pip_package ~/tensorflow_pkg
sudo pip3 install ~/tensorflow_pkg/tensorflow-1.13.1-cp35-cp35m-linux_aarch64.whl
import tensorflow as tf
tf.__version__
tf.__path__
a = tf.placeholder(tf.float32, shape=[2, 2], name="input1")
b = tf.placeholder(tf.float32, shape=[2, 2], name="input2")
ab = tf.matmul(a, b, name="output")
inp1 = [[4., 7.], [2., 6.]]
inp2 = [[0.6, -0.7], [-0.2, 0.4]]
with tf.Session() as sess:
res = sess.run(ab, feed_dict={a: inp1, b: inp2})
print(res)https://www.tensorflow.org/install/source https://collaborate.linaro.org/display/BDTS/Building+and+Installing+Tensorflow+on+AArch64 https://github.com/lhelontra/tensorflow-on-arm/releases
~/tensorflow$ bazel build -c opt \
ERROR: /home/guitar/tensorflow/tensorflow/tools/pip_package/BUILD:149:1: no such package '@icu//': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/unicode-org/icu/archive/release-62-1.tar.gz, https://github.com/unicode-org/icu/archive/release-62-1.tar.gz] to /home/guitar/.cache/bazel/_bazel_guitar/e0ac497cdf93112707a19bb545085e17/external/icu/release-62-1.tar.gz: Checksum was 86b85fbf1b251d7a658de86ce5a0c8f34151027cc60b01e1b76f167379acf181 but wanted e15ffd84606323cbad5515bf9ecdf8061cc3bf80fb883b9e6aa162e485aa9761 and referenced by '//tensorflow/tools/pip_package:licenses'
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: no such package '@icu//': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/unicode-org/icu/archive/release-62-1.tar.gz, https://github.com/unicode-org/icu/archive/release-62-1.tar.gz] to /home/guitar/.cache/bazel/_bazel_guitar/e0ac497cdf93112707a19bb545085e17/external/icu/release-62-1.tar.gz: Checksum was 86b85fbf1b251d7a658de86ce5a0c8f34151027cc60b01e1b76f167379acf181 but wanted e15ffd84606323cbad5515bf9ecdf8061cc3bf80fb883b9e6aa162e485aa9761
INFO: Elapsed time: 81.058s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (338 packages loaded, 18753 target
s configured)
guitar@guitar-desktop:~/tensorflow$
Help me ! I followed you every step what happened.