aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Raj <nikhil.raj@arm.com>2023-05-02 16:46:35 +0100
committerNikhil Raj <nikhil.raj@arm.com>2023-05-03 17:08:36 +0100
commit17086a7da9a3d85ddcd4352f8e4906f02dbf4469 (patch)
tree7ba6bc5af8ee87338571b0f0fd2d4224181b4d2c
parent365fa4b4b96204254a04a22ba7cb2aaec2935246 (diff)
downloadarmnn-17086a7da9a3d85ddcd4352f8e4906f02dbf4469.tar.gz
Minor fixes to the build android ndk guide script
* Aligns both sh script and md file * Change default branch to main as 'latest' release will change every 3 month * Clones github repos instead of mlplatform repos Signed-off-by: Nikhil Raj <nikhil.raj@arm.com> Change-Id: I4bed6c4c231b5f3bab0abf92b0febf825ddb4ce7
-rw-r--r--BuildGuideAndroidNDK.md29
-rwxr-xr-xscripts/build_android_ndk_guide.sh27
2 files changed, 37 insertions, 19 deletions
diff --git a/BuildGuideAndroidNDK.md b/BuildGuideAndroidNDK.md
index b42e7e8916..a133956dbb 100644
--- a/BuildGuideAndroidNDK.md
+++ b/BuildGuideAndroidNDK.md
@@ -21,9 +21,12 @@ The instructions show how to build the Arm NN core library and its dependencies.
For ease of use there is a shell script version of this guide located in the scripts directory called [build_android_ndk_guide.sh](scripts/build_android_ndk_guide.sh).
Run the script with a -h flag to see the command line parameters.
+The shell script version of this guide (build_android_ndk_guide.sh) also provides user the option to use the Arm NN and ComputeLibrary available in your BASE_DIR, instead of downloading a new version.
+BASE_DIR is path to the script file, which is armnn/scripts/.
+
## Initial Setup
-First, we need to specify the Android version and the directories you want to build armnn in and to install some applications required to build Arm NN and its dependencies.
+First, we need to specify the Android version and the directories you want to build Arm NN in and to install some applications required to build Arm NN and its dependencies.
```bash
export ANDROID_API=30
@@ -126,7 +129,7 @@ CXXFLAGS="-fPIC" \
cmake .. \
-DCMAKE_ANDROID_NDK=$NDK_DIR \
-DCMAKE_SYSTEM_NAME=Android \
- -DCMAKE_SYSTEM_VERSION=27 \
+ -DCMAKE_SYSTEM_VERSION=$ANDROID_API \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DCMAKE_CXX_FLAGS=--std=c++14 \
-DFLATBUFFERS_BUILD_FLATC=OFF \
@@ -162,28 +165,34 @@ git pull
## Get And Build TFLite
This optional step is only required if you intend to build the TFLite delegate or parser for Arm NN.
-First clone tensorflow:
+First clone Tensorflow manually and check out the version Arm NN was tested with:
```bash
cd $WORKING_DIR
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git fetch && git checkout "6f692f73cb2043b4a0b0446539cd8c15b3dd9220"
```
-Arm NN provides a script that downloads the version of Tensorflow that Arm NN was tested with:
+Or use the script that Arm NN provides:
```bash
git fetch && git checkout $(../armnn/scripts/get_tensorflow.sh -p)
```
-Next build Tensorflow Lite:
+Next, set variable TFLITE_ROOT_DIR and build Tensorflow Lite:
```bash
+export TFLITE_ROOT_DIR=$WORKING_DIR/tensorflow/tensorflow/lite
cd $WORKING_DIR
mkdir -p tflite-out/android
cd tflite-out/android
-CMARGS="-DCMAKE_TOOLCHAIN_FILE=$NDK_DIR/build/cmake/android.toolchain.cmake \
+CMARGS="-DTFLITE_ENABLE_XNNPACK=OFF \
+ -DFLATBUFFERS_BUILD_FLATC=OFF \
+ -DBUILD_SHARED_LIBS=OFF \
+ -DBUILD_TESTING=OFF"
+
+CMARGS="$CMARGS -DCMAKE_TOOLCHAIN_FILE=$NDK_DIR/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=$ANDROID_API"
-cmake $CMARGS $WORKING_DIR/tensorflow/tensorflow/lite
+cmake $CMARGS $TFLITE_ROOT_DIR
cd $WORKING_DIR
cmake --build tflite-out/android -j 16
@@ -329,7 +338,11 @@ make
Currently adb version we have used for testing is 1.0.41.
```bash
adb push libarmnn.so /data/local/tmp/
- adb push libtimelineDecoder.so /data/local/tmp/
+adb push libtimelineDecoder.so /data/local/tmp/
+adb push libtimelineDecoderJson.so /data/local/tmp/
+adb push GatordMock /data/local/tmp/
+adb push libarmnnBasePipeServer.so /data/local/tmp/
+adb push libarmnnTestUtils.so /data/local/tmp/
adb push UnitTests /data/local/tmp/
adb push $NDK_DIR/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so /data/local/tmp/
```
diff --git a/scripts/build_android_ndk_guide.sh b/scripts/build_android_ndk_guide.sh
index 7f7621862e..66ba282305 100755
--- a/scripts/build_android_ndk_guide.sh
+++ b/scripts/build_android_ndk_guide.sh
@@ -13,8 +13,8 @@ function Usage() {
echo "Options:"
echo " -l Use this copy of Arm NN and ComputeLibrary instead of cloning new copies"
echo " <1 or 0> defaults to 1"
- echo " -a Override Arm NN branch (defaults to latest release branches/armnn_23_02)"
- echo " -b Override ACL branch (defaults to latest release v23.02)"
+ echo " -a Override Arm NN branch (defaults to main branch). For example to use 23.02 release use branch name branches/armnn_23_02"
+ echo " -b Override ACL branch (defaults to main branch). For example to use 23.02 release use tag v23.02"
echo " -A Android API level defaults to 30"
echo " -n Neon (CpuAcc backend) enabled <1 or 0> defaults to 1"
echo " -g CL (GpuAcc backend) enabled <1 or 0> defaults to 1"
@@ -42,8 +42,8 @@ BASE_DIR=$(dirname "$THIS_FILE")
# Set variables and working directory
CREATE_LINKS=1
-ARMNN_BRANCH=branches/armnn_23_02
-ACL_BRANCH=v23.02
+ARMNN_BRANCH=main
+ACL_BRANCH=main
ACL_NEON=1
ACL_CL=1
REFERENCE=1
@@ -164,17 +164,22 @@ function GetArmNN {
cd $WORKING_DIR
if [[ ! -d armnn ]]; then
- if [[ $CREATE_LINKS = 1 && -d $BASE_DIR/../../armnn ]]; then
- echo "+++ Linking Arm NN"
- ln -s $BASE_DIR/../../armnn $WORKING_DIR/armnn
+ if [[ $CREATE_LINKS = 1 ]]; then
+ if [[ -d $BASE_DIR/../../armnn ]]; then
+ echo "+++ Linking Arm NN"
+ echo "$BASE_DIR"
+ ln -s $BASE_DIR/../../armnn $WORKING_DIR/armnn
+ else
+ echo "Couldn't find Arm NN to link"
+ fi
else
echo "+++ Cloning Arm NN"
- git clone https://review.mlplatform.org/ml/armnn.git armnn
+ git clone https://github.com/ARM-software/armnn.git armnn
cd armnn
git checkout $ARMNN_BRANCH
git log -1
- fi
+ fi
fi
}
@@ -188,7 +193,7 @@ function GetAndBuildComputeLibrary {
ln -s $BASE_DIR/../../ComputeLibrary $WORKING_DIR/ComputeLibrary
else
echo "+++ Cloning ComputeLibrary"
- git clone https://review.mlplatform.org/ml/ComputeLibrary.git ComputeLibrary
+ git clone https://github.com/ARM-software/ComputeLibrary.git ComputeLibrary
cd ComputeLibrary
git checkout $($BASE_DIR/../../armnn/scripts/get_compute_library.sh -p)
git log -1
@@ -196,7 +201,7 @@ function GetAndBuildComputeLibrary {
else
echo "+++ Cloning ComputeLibrary"
- git clone https://review.mlplatform.org/ml/ComputeLibrary.git ComputeLibrary
+ git clone https://github.com/ARM-software/ComputeLibrary.git ComputeLibrary
cd ComputeLibrary
git checkout $ACL_BRANCH
git log -1