From c8d7a663dbcc0b92793c79d88685982e7ca908a5 Mon Sep 17 00:00:00 2001 From: James Conroy Date: Fri, 18 Nov 2022 10:17:27 +0000 Subject: IVGCVSW-7330 Fix build-tool args for Docker builds * This change requests users to supply a comma separated string of CMake/scons args so that they can passed down from Docker into the bash script correctly. * Updated documentation to reflect this. Signed-off-by: James Conroy Change-Id: Icbd1d1458e11382936690ca6cc4417677e063ddb --- build-tool/README.md | 8 ++++---- build-tool/scripts/build-armnn.sh | 15 +++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/build-tool/README.md b/build-tool/README.md index b56a6907c5..34c8998569 100644 --- a/build-tool/README.md +++ b/build-tool/README.md @@ -168,8 +168,8 @@ The ```BUILD_ARGS``` string should start and end with **double quotes** ```"```. | --cl-backend | **flag:** build Arm NN with the OpenCL backend (GPU acceleration from ACL) | | --ref-backend | **flag:** build Arm NN with the reference backend
**Should be used for verification purposes only.
Does not provide any performance acceleration.** | | --debug | **flag:** build Arm NN (and ACL) with debug turned on (optional: defaults to off) | -| --armnn-cmake-args= | **option:** provide additional space-separated CMake arguments string for building Arm NN (optional)
String should start and end with **single quotes** ```'```
Please refer to **armnn/cmake/GlobalConfig.cmake** | -| --acl-scons-params= | **option**: provide additional space-separated scons parameters string for building ACL (optional)
String should start and end with **single quotes** ```'```
ACL provide [documentation](https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_1_build_options) for their build options | +| --armnn-cmake-args= | **option:** provide additional comma-separated CMake arguments string for building Arm NN (optional)
String should start and end with **single quotes** ```'```
Please refer to **armnn/cmake/GlobalConfig.cmake** | +| --acl-scons-params= | **option**: provide additional comma-separated scons parameters string for building ACL (optional)
String should start and end with **single quotes** ```'```
ACL provide [documentation](https://arm-software.github.io/ComputeLibrary/latest/how_to_build.xhtml#S1_1_build_options) for their build options | **At least one component** (i.e. ```--tflite-delegate```, ```--tflite-parser```, ```--onnx-parser```) must be provided or else provide ```--all``` to build all Arm NN components.
@@ -181,10 +181,10 @@ Build for aarch64 with all Arm NN components, NEON enabled and OpenCL enabled: -```BUILD_ARGS="--target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1 benchmark_examples=1'"``` +```BUILD_ARGS="--target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1'"``` Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Arm NN cmake args:
-```BUILD_ARGS="--target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1 -DBUILD_UNIT_TESTS=0'"``` +```BUILD_ARGS="--target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1,-DBUILD_UNIT_TESTS=0'"``` **Example _valid_ combination of SETUP_ARGS and BUILD_ARGS:**
``` diff --git a/build-tool/scripts/build-armnn.sh b/build-tool/scripts/build-armnn.sh index c0e4f93277..af663418d5 100755 --- a/build-tool/scripts/build-armnn.sh +++ b/build-tool/scripts/build-armnn.sh @@ -208,9 +208,9 @@ build-armnn.sh [OPTION]... --debug build Arm NN (and ACL) with debug turned on (optional: defaults to off) --armnn-cmake-args= - provide additional space-separated CMake arguments string for building Arm NN (optional) + provide additional comma-separated CMake arguments string for building Arm NN (optional) --acl-scons-params= - provide additional space-separated scons parameters string for building ACL (optional) + provide additional comma-separated scons parameters string for building ACL (optional) --num-threads= specify number of threads/cores to build dependencies with (optional: defaults to number of online CPU cores on host) -h, --help @@ -232,9 +232,9 @@ Examples: Build for aarch64 with all Arm NN components, NEON enabled and OpenCL enabled: /build-armnn.sh --target-arch=aarch64 --all --neon-backend --cl-backend Build for aarch64 with TF Lite Delegate, OpenCL enabled and additional ACL scons params: - /build-armnn.sh --target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1 benchmark_examples=1' + /build-armnn.sh --target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1' Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Arm NN cmake args: - /build-armnn.sh --target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1 -DBUILD_UNIT_TESTS=0' + /build-armnn.sh --target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1,-DBUILD_UNIT_TESTS=0' EOF } @@ -419,6 +419,13 @@ if [ "$flag_debug" -eq 1 ]; then DEBUG_POSTFIX="_debug" fi +# Replace commas with spaces in additional Arm NN / ACL build args +# shellcheck disable=SC2001 +armnn_cmake_args="$(echo "$armnn_cmake_args" | sed 's/,/ /g')" + +# shellcheck disable=SC2001 +acl_scons_params="$(echo "$acl_scons_params" | sed 's/,/ /g')" + # Directories for Arm NN and ACL build outputs ARMNN_BUILD_ROOT="$BUILD_DIR"/armnn ARMNN_BUILD_DIR_NAME="$TARGET_ARCH"_build"$DEBUG_POSTFIX" -- cgit v1.2.1