From 2ca9a14b04f31f6a029b2747d39ee49a682eddab Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Mon, 20 Dec 2021 13:27:04 +0000 Subject: IVGCVSW-6668 Updating build guides * Updated build guides to refer to get_compute_library.sh and get_tensorflow.sh * Corrected TensorFlow Version in guides was v2.5.1 but release notes say v2.5.0 * Reordered command sequence to ensure that Arm NN is downloaded and ready before downloading TensorFlow or Arm Compute Library * Fixed hyperlinks in MD files * Added whitespace to fix MD formatting. Signed-off-by: Mike Kelly Change-Id: Iabc309cbbd41d969eb1e11e9dd33a0b1da39a27b --- delegate/BuildGuideNative.md | 43 ++++++++++++++++++++++++------------- delegate/DelegateQuickStartGuide.md | 4 ++-- 2 files changed, 30 insertions(+), 17 deletions(-) (limited to 'delegate') diff --git a/delegate/BuildGuideNative.md b/delegate/BuildGuideNative.md index 62d6673925..932c74423a 100644 --- a/delegate/BuildGuideNative.md +++ b/delegate/BuildGuideNative.md @@ -11,6 +11,7 @@ natively (no cross-compilation required). This is to keep this guide simple. **Table of content:** - [Delegate build guide introduction](#delegate-build-guide-introduction) - [Dependencies](#dependencies) + * [Download Arm NN](#download-arm-nn) * [Build Tensorflow Lite for C++](#build-tensorflow-lite-for-c--) * [Build Flatbuffers](#build-flatbuffers) * [Build the Arm Compute Library](#build-the-arm-compute-library) @@ -23,7 +24,7 @@ natively (no cross-compilation required). This is to keep this guide simple. # Dependencies Build Dependencies: - * Tensorflow Lite: this guide uses version 2.5.1 . Other versions may work. + * Tensorflow Lite: this guide uses version 2.5.0. Other versions may work. * Flatbuffers 1.12.0 * Arm NN 21.11 or higher @@ -45,6 +46,18 @@ mkdir $BASEDIR cd $BASEDIR apt-get update && apt-get install git wget unzip zip python git cmake scons ``` + +## Download Arm NN + +First clone Arm NN using Git. + +```bash +cd $BASEDIR +git clone "https://review.mlplatform.org/ml/armnn" +cd armnn +git checkout # e.g. branches/armnn_21_11 +``` + ## Build Tensorflow Lite for C++ Tensorflow has a few dependencies on it's own. It requires the python packages pip3, numpy, and also Bazel or CMake which are used to compile Tensorflow. A description on how to build bazel can be @@ -65,13 +78,14 @@ sudo make install ``` ### Download and build Tensorflow Lite - +Arm NN provides a script, armnn/scripts/get_tensorflow.sh, that can be used to download the version of TensorFlow that Arm NN was tested with: ```bash cd $BASEDIR git clone https://github.com/tensorflow/tensorflow.git cd tensorflow/ -git checkout tags/v2.5.1 # Minimum version required for the delegate is v2.3.1 +git checkout $(../armnn/scripts/get_tensorflow.sh -p) # Minimum version required for the delegate is v2.3.1 ``` + Now the build process can be started. When calling "cmake", as below, you can specify a number of build flags. But if you have no need to configure your tensorflow build, you can follow the exact commands below: ```bash @@ -100,17 +114,19 @@ The Arm NN library depends on the Arm Compute Library (ACL). It provides a set o both Arm CPUs and GPUs. The Arm Compute Library is used directly by Arm NN to run machine learning workloads on Arm CPUs and GPUs. -It is important to have the right version of ACL and Arm NN to make it work. Luckily, Arm NN and ACL are developed -very closely and released together. If you would like to use the Arm NN version "20.11" you should use the same "20.11" -version for ACL too. +It is important to have the right version of ACL and Arm NN to make it work. Arm NN and ACL are developed very closely +and released together. If you would like to use the Arm NN version "21.11" you should use the same "21.11" version for +ACL too. Arm NN provides a script, armnn/scripts/get_compute_library.sh, that can be used to download the exact version +of Arm Compute Library that Arm NN was tested with. + +To build the Arm Compute Library on your platform, download the Arm Compute Library and checkout the tag that contains +the version you want to use. Build it using `scons`. -To build the Arm Compute Library on your platform, download the Arm Compute Library and checkout the tag -that contains the version you want to use. Build it using `scons`. ```bash -cd $BASEDIR +cd $HOME/armnn-devenv git clone https://review.mlplatform.org/ml/ComputeLibrary cd ComputeLibrary/ -git checkout # e.g. v20.11 +git checkout $(../armnn/scripts/get_compute_library.sh -p) # e.g. v21.11 # The machine used for this guide only has a Neon CPU which is why I only have "neon=1" but if # your machine has an arm Gpu you can enable that by adding `opencl=1 embed_kernels=1 to the command below scons arch=arm64-v8a neon=1 extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0 @@ -118,13 +134,10 @@ scons arch=arm64-v8a neon=1 extra_cxx_flags="-fPIC" benchmark_tests=0 validation ## Build the Arm NN Library -With ACL built we can now continue to building Arm NN. To do so, download the repository and checkout the matching -version as you did for ACL. Create a build directory and use `cmake` to build it. +With ACL built we can now continue to build Arm NN. Create a build directory and use `cmake` to build it. ```bash cd $BASEDIR -git clone "https://review.mlplatform.org/ml/armnn" cd armnn -git checkout # e.g. branches/armnn_20_11 mkdir build && cd build # if you've got an arm Gpu add `-DARMCOMPUTECL=1` to the command below cmake .. -DARMCOMPUTE_ROOT=$BASEDIR/ComputeLibrary -DARMCOMPUTENEON=1 -DBUILD_UNIT_TESTS=0 @@ -172,7 +185,7 @@ Download Arm NN if you have not already done so: cd $BASEDIR git clone "https://review.mlplatform.org/ml/armnn" cd armnn -git checkout # e.g. branches/armnn_20_11 +git checkout # e.g. branches/armnn_21_11 ``` Build Arm NN with the delegate included ```bash diff --git a/delegate/DelegateQuickStartGuide.md b/delegate/DelegateQuickStartGuide.md index ed462b2a1b..b581bce62c 100644 --- a/delegate/DelegateQuickStartGuide.md +++ b/delegate/DelegateQuickStartGuide.md @@ -47,7 +47,7 @@ you can download the binaries [here](https://github.com/ARM-software/armnn/relea We recommend creating a virtual environment for this tutorial. For the following code to work python3 is needed. Please also check the documentation of the TfLite version you want to use. There might be additional prerequisites for the python -version. We will use Tensorflow Lite 2.5.1 for this guide. +version. We will use Tensorflow Lite 2.5.0 for this guide. ```bash # Install python3 (We ended up with python3.5.3) and virtualenv sudo apt-get install python3-pip @@ -71,7 +71,7 @@ mobile and embedded devices. The TfLite [website](https://www.tensorflow.org/lite/guide/python) shows you two methods to download the `tflite_runtime` package. In our experience, the use of the pip command works for most systems including debian. However, if you're using an older version of Tensorflow, you may need to build the pip package from source. You can find more information [here](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/tools/pip_package/README.md). -But in our case, with Tensorflow Lite 2.5.1, we can install through: +But in our case, with Tensorflow Lite 2.5.0, we can install through: ``` pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime -- cgit v1.2.1