aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Raj <nikhil.raj@arm.com>2022-02-11 11:04:37 +0000
committerColm Donelan <colm.donelan@arm.com>2022-02-15 21:24:03 +0000
commitf9b7bb4f75b4bbb3d573a5388b2820f6e51cebc1 (patch)
treebed72e521ff44c279de0dd66f0bc9198f58e9533
parent1855c6b2d21c04d054f6ebd1160c70c669e92a07 (diff)
downloadarmnn-f9b7bb4f75b4bbb3d573a5388b2820f6e51cebc1.tar.gz
Update build guides and FAQ
* Updated BuildGuideAndroidNDK.md * Updated BuildGuideCrossCompilation.md * Updated FAQ.md in docs/ Signed-off-by: Nikhil Raj <nikhil.raj@arm.com> Change-Id: I96fa9cedf0da3b3b96fa26a2c36fcce2ac9de151
-rw-r--r--BuildGuideAndroidNDK.md17
-rw-r--r--BuildGuideCrossCompilation.md73
-rw-r--r--docs/FAQ.md16
3 files changed, 73 insertions, 33 deletions
diff --git a/BuildGuideAndroidNDK.md b/BuildGuideAndroidNDK.md
index 9936bf2df1..5068a8f5c8 100644
--- a/BuildGuideAndroidNDK.md
+++ b/BuildGuideAndroidNDK.md
@@ -12,7 +12,7 @@
## Introduction
These are step by step instructions for using the Android NDK to build Arm NN.
-They have been tested on a clean install of Ubuntu 18.04, and should also work with other OS versions.
+They have been tested on a clean install of Ubuntu 18.04 and 20.04, and should also work with other OS versions.
The instructions show how to build the Arm NN core library.
Building protobuf is optional. We have given steps should the user wish to build it (i.e. as an Onnx dependency).
All downloaded or generated files will be saved inside the `$HOME/armnn-devenv` directory.
@@ -37,7 +37,7 @@ All downloaded or generated files will be saved inside the `$HOME/armnn-devenv`
## Build Google's Protobuf library (Optional)
-* Clone protobuf:
+* Clone protobuf:
(Requires Git if not previously installed: `sudo apt install git`)
```bash
mkdir $HOME/armnn-devenv/google
@@ -47,7 +47,7 @@ cd protobuf
git checkout -b v3.12.0 v3.12.0
```
-* Build a native (x86) version of the protobuf libraries and compiler (protoc):
+* Build a native (x86) version of the protobuf libraries and compiler (protoc):
(Requires cUrl, autoconf, llibtool, and other build dependencies if not previously installed: `sudo apt install curl autoconf libtool build-essential g++`)
```bash
./autogen.sh
@@ -77,7 +77,7 @@ cd ..
Note: The ANDROID_API variable should be set to the Android API version number you are using. E.g. "30" for Android R.
## Download Arm NN
-* Clone Arm NN:
+* Clone Arm NN:
(Requires Git if not previously installed: `sudo apt install git`)
```bash
@@ -110,15 +110,18 @@ git clone https://github.com/ARM-software/ComputeLibrary.git
cd ComputeLibrary
git checkout <tag_name>
```
-Arm NN and Arm Compute Library are developed closely together. If you would like to use the Arm NN 21.11 release you will need the 21.11 release of ACL too. For example, if you want to checkout the 21.11 release tag:
+For example, if you want to checkout the 21.11 release tag:
```bash
git checkout v21.11
```
+
+Arm NN and Arm Compute Library are developed closely together. If you would like to use a particular release of Arm NN you will need the same release tag of ACL too.
+
Arm NN provides a script that downloads the version of Arm Compute Library that Arm NN was tested with:
```bash
git checkout $(../armnn/scripts/get_compute_library.sh -p)
```
-* the Arm Compute Library:
+* the Arm Compute Library:
(Requires SCons if not previously installed: `sudo apt install scons`)
```bash
scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
@@ -127,7 +130,7 @@ scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
## Build Arm NN
-* Build Arm NN:
+* Build Arm NN:
(Requires CMake if not previously installed: `sudo apt install cmake`)
```bash
mkdir $HOME/armnn-devenv/armnn/build
diff --git a/BuildGuideCrossCompilation.md b/BuildGuideCrossCompilation.md
index 53a9d719bf..d5d1a227e1 100644
--- a/BuildGuideCrossCompilation.md
+++ b/BuildGuideCrossCompilation.md
@@ -2,6 +2,7 @@
- [Introduction](#introduction)
- [Cross-compiling ToolChain](#cross-compiling-toolchain)
+- [Install Cmake](#build-cmake)
- [Build and install Google's Protobuf library](#build-and-install-google-s-protobuf-library)
- [Download Arm NN](#download-arm-nn)
- [Build Arm Compute Library](#build-arm-compute-library)
@@ -9,13 +10,14 @@
- [Build Onnx](#build-onnx)
- [Build TfLite](#build-tflite)
- [Build Arm NN](#build-armnn)
+- [Generate TF Lite Schema](#generate-tflite-schema)
- [Build Standalone Sample Dynamic Backend](#build-standalone-sample-dynamic-backend)
- [Run Unit Tests](#run-unit-tests)
- [Troubleshooting and Errors:](#troubleshooting-and-errors-)
## Introduction
-These are the step by step instructions on Cross-Compiling Arm NN under an x86_64 system to target an Arm64 system. This build flow has been tested with Ubuntu 18.04 and it depends on the same version of Ubuntu or Debian being installed on both the build host and target machines. The instructions assume you are using a bash shell and show how to build the Arm NN core library, Protobuf, Tflite, Flatbuffer and Compute Libraries.
+These are the step by step instructions on Cross-Compiling Arm NN under an x86_64 system to target an Arm64 system. This build flow has been tested with Ubuntu 18.04 and 20.04 and it depends on the same version of Ubuntu or Debian being installed on both the build host and target machines. The instructions assume you are using a bash shell and show how to build the Arm NN core library, Protobuf, Tflite, Flatbuffer and Compute Libraries.
Start by creating a directory to contain all components:
'''
@@ -29,6 +31,20 @@ cd $HOME/armnn-devenv
sudo apt install crossbuild-essential-arm64
```
+## Install Cmake
+Cmake 3.19rc3 is required to build TF Lite Delegate.
+
+'''
+sudo apt-get install libssl-dev
+wget https://github.com/Kitware/CMake/releases/download/v3.19.0-rc3/cmake-3.19.0-rc3.tar.gz
+tar -zxvf cmake-3.19.0-rc3.tar.gz
+cd cmake-3.19.0-rc3
+./bootstrap --prefix=$HOME/armnn-devenv/cmake/install
+make all install
+cd..
+'''
+
+
## Build and install Google's Protobuf library
We support protobuf version 3.12.0
@@ -101,15 +117,14 @@ Arm NN provides a script that downloads the version of Arm Compute Library that
```bash
git checkout $(../armnn/scripts/get_compute_library.sh -p)
```
-* Build the Arm Compute Library:
+* Build the Arm Compute Library:
(Requires SCons if not previously installed: `sudo apt install scons`)
```bash
-scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j4 internal_only=0
+scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j4
```
## Build Flatbuffer
* Building Flatbuffer version 1.12.0
- (Requires CMake if not previously installed: `sudo apt install cmake`)
```bash
cd $HOME/armnn-devenv
wget -O flatbuffers-1.12.0.tar.gz https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz
@@ -157,8 +172,31 @@ cd $HOME/armnn-devenv
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow/
git checkout $(../armnn/scripts/get_tensorflow.sh -p) # Checks out the latest tested version of TF
-mkdir tflite
-cd tflite
+cd ..
+```
+
+* You will need to download gcc-arm-8.3-2019.03 toolchain and continue building TF Lite as following:
+```
+curl -LO https://storage.googleapis.com/mirror.tensorflow.org/developer.arm.com/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
+mkdir tflite-toolchains
+tar xvf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C tflite-toolchains
+mkdir tflite/build
+cd tflite/build
+ARMCC_PREFIX=$HOME/armnn-devenv/tflite-toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu- \
+ARMCC_FLAGS="-funsafe-math-optimizations" \
+cmake -DCMAKE_C_COMPILER=${ARMCC_PREFIX}gcc \
+ -DCMAKE_CXX_COMPILER=${ARMCC_PREFIX}g++ \
+ -DCMAKE_C_FLAGS="${ARMCC_FLAGS}" -DCMAKE_CXX_FLAGS="${ARMCC_FLAGS}" \
+ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_SYSTEM_NAME=Linux \
+ -DTFLITE_ENABLE_XNNPACK=OFF \
+ -DCMAKE_SYSTEM_PROCESSOR=aarch64 \
+ $HOME/armnn-devenv/tensorflow/tensorflow/lite/ \
+cmake --build .
+```
+
+## Generate TF Lite Schema
+```
+cd $HOME/armnn-devenv
cp ../tensorflow/tensorflow/lite/schema/schema.fbs .
../flatbuffers-1.12.0/build/flatc -c --gen-object-api --reflect-types --reflect-names schema.fbs
```
@@ -181,7 +219,7 @@ CXX=aarch64-linux-gnu-g++ CC=aarch64-linux-gnu-gcc cmake .. \
-DONNX_GENERATED_SOURCES=$HOME/armnn-devenv/onnx \
-DBUILD_ONNX_PARSER=1 \
-DBUILD_TF_LITE_PARSER=1 \
--DTF_LITE_GENERATED_PATH=$HOME/armnn-devenv/tflite \
+-DTENSORFLOW_ROOT=$HOME/armnn-devenv/tensorflow \
-DFLATBUFFERS_ROOT=$HOME/armnn-devenv/flatbuffers-arm64 \
-DFLATC_DIR=$HOME/armnn-devenv/flatbuffers-1.12.0/build \
-DPROTOBUF_ROOT=$HOME/armnn-devenv/google/x86_64_pb_install \
@@ -195,6 +233,12 @@ CXX=aarch64-linux-gnu-g++ CC=aarch64-linux-gnu-gcc cmake .. \
-DSAMPLE_DYNAMIC_BACKEND=1 \
-DDYNAMIC_BACKEND_PATHS=$SAMPLE_DYNAMIC_BACKEND_PATH
```
+* If you want to build Arm NN TF Lite Delegate, add the arguments:
+```bash
+-DTFLITE_LIB_ROOT=$HOME/armnn-devenv/tflite/build \
+-DTF_LITE_SCHEMA_INCLUDE_PATH=$HOME/armnn-devenv/tflite \
+-DBUILD_ARMNN_TFLITE_DELEGATE=1
+```
* Run the build
```bash
make -j32
@@ -241,9 +285,18 @@ ln -s libprotobuf.so.23.0.0 ./libprotobuf.so.23
```bash
LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./UnitTests
-Running 4493 test cases...
+[doctest] doctest version is "2.4.6"
+[doctest] run with "--help" for options
+===============================================================================
+[doctest] test cases: 4817 | 4817 passed | 0 failed | 0 skipped
+[doctest] assertions: 807634 | 807634 passed | 0 failed |
+[doctest] Status: SUCCESS!
+```
-*** No errors detected
+* Run the Delegate UnitTests:
+
+```bash
+LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./delegate/DelegateUnitTests
```
## Troubleshooting and Errors:
@@ -309,5 +362,5 @@ cc1plus: error: unrecognized command line option ‘-Wno-implicit-fallthrough’
```
* Add Werror=0 to the scons command:
```
-scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 internal_only=0 Werror=0
+scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" -j8 Werror=0
```
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 6771e50f19..0e6fcf84b9 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -1,10 +1,6 @@
Frequently asked questions
==========================
-These are issues that have been commonly seen when using Arm NN.
-
-Note: The 21.08 release of Arm NN removes Boost library dependency. You are not required to install boost library with 21.08 and newer releases.
-
Problems seen when trying to build armnn and ComputeLibrary obtained from GitHub
-----------------------------------------------------------------------------
@@ -32,18 +28,6 @@ Many DynamicBackendTests fail with "Base path for shared objects does not exist"
---------------------------------------------------------
This problem most commonly occurs when the compile and runtime environments for the unit tests differ. These dynamic backend tests rely on a set of test files and directories at runtime. These files are created by default during the cmake build. At runtime the tests will look for these files in src/backends/backendsCommon/test/ relative to where the Unittests executable was built. The usual solution to to copy these files and directories into the new unit test execution environment. You can also specify a new root path for these files by adding a command line parameter to the Unittests executable: Unittests -- --dynamic-backend-build-dir "new path"
-UnitTests fail on Max OS-X with errors in boost::program_options
----------------------------------------------------------
-When executing Arm NN UnitTests built in an OS-X environment, runtime errors occur around boost::program_options. When compiling boost the "b2" tool appears to have a bug where it defaults to using the native ranlib even when the correct tool is specified in the user_config.jam.
-
-To validate that this issue is occurring inspect the boost build log looking for warnings like:
-warning: ranlib: warning for library: libboost_atomic.a the table of contents is empty (no object file members in the library define global symbols)
-
-This problem has previously been reported to the boostorg GitHub project. The solution is to manually execute the correct ranlib on each static library. https://github.com/boostorg/build/issues/160
-
-Arm NN fails to build on Ubuntu 20.04
----------------------------------------------------------
-The compiler version update on Ubuntu 20.04 resulted in build errors in Flat buffers 1.10.0. Update to Flatbuffers 1.12.0 to resolve this problem. In addition when building flatbuffers specify -fPIC CXX flag to allow the libraries to be used in our shared objects. Without this the the Arm NN build can fail with libflatbuffers.a(util.cpp.o): relocation R_X86_64_PC32 against symbol `_ZN11flatbuffers9DirExistsEPKc' can not be used when making a shared object; recompile with -fPIC
Tensorflow Lite benchmarking tool fails with segmentation fault when using the Arm NN delegate.
---------------------------------------------------------