James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright © 2022 Arm Ltd and Contributors. All rights reserved. |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | # Script which builds Arm NN and ACL |
| 8 | # setup-armnn.sh must be executed in the same directory, before running this script |
| 9 | |
| 10 | set -o nounset # Catch references to undefined variables. |
| 11 | set -o pipefail # Catch non zero exit codes within pipelines. |
| 12 | set -o errexit # Catch and propagate non zero exit codes. |
| 13 | |
| 14 | rel_path=$(dirname "$0") # relative path from where script is executed to script location |
| 15 | |
| 16 | build_acl() |
| 17 | { |
| 18 | cd "$ACL_SRC" |
| 19 | |
James Conroy | e6f30ad | 2022-09-08 12:04:26 +0100 | [diff] [blame] | 20 | # $acl_scons_params are additional options provided by the user and will overwrite any previously defined args |
| 21 | local acl_params="neon=$flag_neon_backend opencl=$flag_cl_backend Werror=0 embed_kernels=1 examples=0 validation_tests=0 benchmark_tests=0 benchmark_examples=0 $acl_scons_params" |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 22 | |
| 23 | if [ "$flag_debug" -eq 1 ]; then |
| 24 | acl_params="$acl_params debug=1 asserts=1" |
| 25 | fi |
| 26 | |
| 27 | local native_flag="" |
| 28 | if [ "$NATIVE_BUILD" ]; then |
| 29 | native_flag="build=native" |
| 30 | fi |
| 31 | |
| 32 | # Force -fPIC so that ACL is suitable for inclusion in Arm NN library |
| 33 | local extra_cxx_flags="extra_cxx_flags='-fPIC'" |
| 34 | |
| 35 | local compile_flags="" |
| 36 | local acl_arch="" |
| 37 | |
| 38 | case "$TARGET_ARCH" in |
| 39 | "aarch64") |
| 40 | compile_flags+="$AARCH64_COMPILER_FLAGS" |
| 41 | acl_arch="arch=arm64-v8a" |
| 42 | ;; |
| 43 | |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 44 | "x86_64") |
| 45 | acl_arch="arch=x86_64" |
| 46 | ;; |
| 47 | esac |
| 48 | |
| 49 | echo -e "\n***** Building ACL for $TARGET_ARCH *****" |
| 50 | |
| 51 | if [ "$flag_clean" -eq 1 ]; then |
| 52 | echo -e "\n***** Clean flag detected: removing existing ACL build *****" |
| 53 | rm -rf "$ACL_BUILD_TARGET" |
| 54 | fi |
| 55 | |
| 56 | mkdir -p "$ACL_BUILD_TARGET" |
| 57 | |
| 58 | eval "$compile_flags" \ |
| 59 | scons "$native_flag" \ |
| 60 | "$acl_arch" \ |
| 61 | "$acl_params" \ |
| 62 | build_dir="$ACL_BUILD_TARGET" \ |
| 63 | "$extra_cxx_flags" \ |
| 64 | -j "$NUM_THREADS" |
| 65 | |
| 66 | echo -e "\n***** Built ACL for $TARGET_ARCH *****" |
| 67 | |
| 68 | return 0 |
| 69 | } |
| 70 | |
| 71 | build_armnn() |
| 72 | { |
| 73 | mkdir -p "$ARMNN_BUILD_TARGET" |
| 74 | cd "$ARMNN_BUILD_TARGET" |
| 75 | |
| 76 | local build_type="Release" |
| 77 | if [ "$flag_debug" -eq 1 ]; then |
| 78 | build_type="Debug" |
| 79 | fi |
| 80 | |
| 81 | local compile_flags="" |
| 82 | |
| 83 | case "$TARGET_ARCH" in |
| 84 | "aarch64") |
| 85 | compile_flags+="$AARCH64_COMPILER_FLAGS" |
| 86 | ;; |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 87 | esac |
| 88 | |
| 89 | if [ "$flag_clean" -eq 1 ]; then |
| 90 | echo -e "\n***** Clean flag detected: removing existing Arm NN build *****" |
| 91 | rm -rf "$ARMNN_BUILD_TARGET" |
| 92 | fi |
| 93 | |
| 94 | echo -e "\n***** Building Arm NN for $TARGET_ARCH *****" |
| 95 | |
| 96 | eval "$compile_flags" \ |
| 97 | cmake -DCMAKE_BUILD_TYPE="$build_type" \ |
| 98 | -DBUILD_ARMNN_TFLITE_DELEGATE="$flag_tflite_delegate" \ |
| 99 | -DBUILD_TF_LITE_PARSER="$flag_tflite_parser" \ |
| 100 | -DBUILD_ONNX_PARSER="$flag_onnx_parser" \ |
| 101 | -DARMCOMPUTENEON="$flag_neon_backend" \ |
| 102 | -DARMCOMPUTECL="$flag_cl_backend" \ |
| 103 | -DARMNNREF="$flag_ref_backend" \ |
| 104 | -DARMCOMPUTE_ROOT="$ACL_SRC" \ |
| 105 | -DARMCOMPUTE_BUILD_DIR="$ACL_BUILD_TARGET" \ |
| 106 | -DTENSORFLOW_ROOT="$TENSORFLOW_SRC" \ |
| 107 | -DTF_LITE_SCHEMA_INCLUDE_PATH="$TFLITE_BUILD_ROOT" \ |
| 108 | -DTFLITE_LIB_ROOT="$TFLITE_BUILD_TARGET" \ |
| 109 | -DFLATBUFFERS_ROOT="$FLATBUFFERS_BUILD_TARGET" \ |
| 110 | -DFLATC_DIR="$FLATBUFFERS_BUILD_HOST" \ |
| 111 | -DONNX_GENERATED_SOURCES="$ONNX_BUILD_TARGET" \ |
| 112 | -DPROTOBUF_ROOT="$PROTOBUF_BUILD_HOST" \ |
| 113 | -DPROTOBUF_LIBRARY_DEBUG="$PROTOBUF_LIBRARY_TARGET" \ |
| 114 | -DPROTOBUF_LIBRARY_RELEASE="$PROTOBUF_LIBRARY_TARGET" \ |
| 115 | "$armnn_cmake_args" \ |
| 116 | "$ARMNN_SRC" |
| 117 | |
| 118 | make -j "$NUM_THREADS" |
| 119 | |
| 120 | # Copy protobuf library into Arm NN build directory, if ONNX Parser is enabled |
| 121 | if [ "$flag_onnx_parser" -eq 1 ]; then |
| 122 | cd "$ARMNN_BUILD_TARGET" |
| 123 | rm -f libprotobuf.so libprotobuf.so.23 libprotobuf.so.23.0.0 |
| 124 | cp "$PROTOBUF_LIBRARY_TARGET" . |
| 125 | ln -s libprotobuf.so.23.0.0 ./libprotobuf.so.23 |
| 126 | ln -s libprotobuf.so.23.0.0 ./libprotobuf.so |
| 127 | fi |
| 128 | |
| 129 | echo -e "\n***** Built Arm NN for $TARGET_ARCH *****" |
| 130 | |
| 131 | local tarball_path="$ROOT_DIR/armnn_$ARMNN_BUILD_DIR_NAME.tar.gz" |
| 132 | echo -e "\n***** Creating tarball of Arm NN build at $tarball_path *****" |
| 133 | |
| 134 | cd "$ARMNN_BUILD_ROOT" |
| 135 | rm -f "$tarball_path" |
| 136 | tar -czf "$tarball_path" "$ARMNN_BUILD_DIR_NAME" |
| 137 | |
| 138 | echo -e "\n***** Created tarball of Arm NN build at $ROOT_DIR/armnn_$ARMNN_BUILD_DIR_NAME.tar.gz *****" |
| 139 | echo -e "\n***** To extract tarball, run: tar -xzf armnn_$ARMNN_BUILD_DIR_NAME.tar.gz *****\n" |
| 140 | |
| 141 | return 0 |
| 142 | } |
| 143 | |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 144 | download_armnn() |
| 145 | { |
| 146 | cd "$SOURCE_DIR" |
| 147 | |
| 148 | echo -e "\n***** Downloading Arm NN *****" |
| 149 | |
| 150 | rm -rf "$ARMNN_SRC" |
| 151 | |
| 152 | # Latest release branch of Arm NN is checked out by default |
| 153 | git clone https://github.com/ARM-software/armnn.git armnn |
| 154 | |
| 155 | cd "$ARMNN_SRC" |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 156 | local armnn_branch="$(git rev-parse --abbrev-ref HEAD)" |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 157 | |
| 158 | echo -e "\n***** Arm NN Downloaded: $armnn_branch *****" |
| 159 | } |
| 160 | |
| 161 | download_acl() |
| 162 | { |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 163 | # First get Arm NN branch so that we can download corresponding ACL tag |
| 164 | cd "$ARMNN_SRC" |
| 165 | local armnn_branch="$(git rev-parse --abbrev-ref HEAD)" |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 166 | |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 167 | echo -e "\n***** Downloading corresponding ACL version using Arm NN branch: $armnn_branch *****" |
| 168 | |
| 169 | cd "$SOURCE_DIR" |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 170 | |
| 171 | rm -rf "$ACL_SRC" |
| 172 | |
| 173 | git clone https://github.com/ARM-software/ComputeLibrary.git acl |
| 174 | |
| 175 | # Get corresponding release tag for ACL by parsing release branch number for Arm NN |
| 176 | local acl_tag="" |
| 177 | acl_tag="$(echo "$armnn_branch" | tr '\n' ' ' | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g' | tr -s ' ' | sed 's/ /./g')" |
| 178 | |
| 179 | cd "$ACL_SRC" |
| 180 | git checkout v"$acl_tag" |
| 181 | |
| 182 | echo -e "\n***** ACL Downloaded: $acl_tag *****" |
| 183 | } |
| 184 | |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 185 | usage() |
| 186 | { |
| 187 | cat <<EOF |
| 188 | build-armnn.sh - Build Arm NN and ACL |
| 189 | build-armnn.sh [OPTION]... |
| 190 | --tflite-delegate |
| 191 | build the Arm NN TF Lite Delegate component |
| 192 | --tflite-parser |
| 193 | build the Arm NN TF Lite Parser component |
| 194 | --onnx-parser |
| 195 | build the Arm NN ONNX parser component |
| 196 | --all |
| 197 | build all Arm NN components listed above |
James Conroy | e6f30ad | 2022-09-08 12:04:26 +0100 | [diff] [blame] | 198 | --target-arch=[aarch64|x86_64] |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 199 | specify a target architecture (mandatory) |
| 200 | --neon-backend |
| 201 | build Arm NN with the NEON backend (CPU acceleration from ACL) |
| 202 | --cl-backend |
| 203 | build Arm NN with the OpenCL backend (GPU acceleration from ACL) |
| 204 | --ref-backend |
| 205 | build Arm NN with the reference backend (Should be used for verification purposes only. Does not provide any performance acceleration.) |
| 206 | --clean |
| 207 | remove previous Arm NN and ACL build prior to script execution (optional: defaults to off) |
| 208 | --debug |
| 209 | build Arm NN (and ACL) with debug turned on (optional: defaults to off) |
| 210 | --armnn-cmake-args=<ARG LIST STRING> |
James Conroy | c8d7a66 | 2022-11-18 10:17:27 +0000 | [diff] [blame] | 211 | provide additional comma-separated CMake arguments string for building Arm NN (optional) |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 212 | --acl-scons-params=<PARAM LIST STRING> |
James Conroy | c8d7a66 | 2022-11-18 10:17:27 +0000 | [diff] [blame] | 213 | provide additional comma-separated scons parameters string for building ACL (optional) |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 214 | --num-threads=<INTEGER> |
| 215 | specify number of threads/cores to build dependencies with (optional: defaults to number of online CPU cores on host) |
| 216 | -h, --help |
| 217 | print brief usage information and exit |
| 218 | -x |
| 219 | enable shell tracing in this script |
| 220 | |
| 221 | 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. |
| 222 | At least one backend (i.e. --neon-backend, --cl-backend, --ref-backend) must be chosen. |
| 223 | This script must be executed from the same root directory in which setup-armnn.sh was executed from. |
| 224 | |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 225 | The first execution of this script will download the latest release branches of Arm NN and ACL, by default. |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 226 | Alternatively, place custom/modified repositories named "armnn" and (optionally) "acl" in <ROOT_DIR>/source. |
| 227 | Providing custom "acl" repo is optional since it is only required if backend flags --neon-backend or --cl-backend are chosen. |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 228 | |
| 229 | By default, a tarball tar.gz archive of the Arm NN build will be created in the directory from which this script is called from. |
| 230 | |
| 231 | Examples: |
| 232 | Build for aarch64 with all Arm NN components, NEON enabled and OpenCL enabled: |
| 233 | <PATH_TO>/build-armnn.sh --target-arch=aarch64 --all --neon-backend --cl-backend |
| 234 | Build for aarch64 with TF Lite Delegate, OpenCL enabled and additional ACL scons params: |
James Conroy | c8d7a66 | 2022-11-18 10:17:27 +0000 | [diff] [blame] | 235 | <PATH_TO>/build-armnn.sh --target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_kernels=1,benchmark_examples=1' |
James Conroy | e6f30ad | 2022-09-08 12:04:26 +0100 | [diff] [blame] | 236 | Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Arm NN cmake args: |
James Conroy | c8d7a66 | 2022-11-18 10:17:27 +0000 | [diff] [blame] | 237 | <PATH_TO>/build-armnn.sh --target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1,-DBUILD_UNIT_TESTS=0' |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 238 | EOF |
| 239 | } |
| 240 | |
| 241 | # This will catch in validation.sh if not set |
| 242 | target_arch="" |
| 243 | |
| 244 | # Default flag values |
| 245 | flag_tflite_delegate=0 |
| 246 | flag_tflite_parser=0 |
| 247 | flag_onnx_parser=0 |
| 248 | flag_neon_backend=0 |
| 249 | flag_cl_backend=0 |
| 250 | flag_ref_backend=0 |
| 251 | flag_clean=0 |
| 252 | flag_debug=0 |
| 253 | |
| 254 | # Empty strings for optional additional args by default |
| 255 | armnn_cmake_args="" |
| 256 | acl_scons_params="" |
| 257 | |
| 258 | # If --num-threads is not set, the default NUM_THREADS value in common.sh will be used |
| 259 | num_threads=0 |
| 260 | |
| 261 | name=$(basename "$0") |
| 262 | |
| 263 | # If no options provided, show help |
| 264 | if [ $# -eq 0 ]; then |
| 265 | usage |
| 266 | exit 1 |
| 267 | fi |
| 268 | |
| 269 | args=$(getopt -ohx -l tflite-delegate,tflite-parser,onnx-parser,all,target-arch:,neon-backend,cl-backend,ref-backend,clean,debug,armnn-cmake-args:,acl-scons-params:,num-threads:,help -n "$name" -- "$@") |
| 270 | eval set -- "$args" |
| 271 | while [ $# -gt 0 ]; do |
| 272 | if [ -n "${opt_prev:-}" ]; then |
| 273 | eval "$opt_prev=\$1" |
| 274 | opt_prev= |
| 275 | shift 1 |
| 276 | continue |
| 277 | elif [ -n "${opt_append:-}" ]; then |
| 278 | if [ -n "$1" ]; then |
| 279 | eval "$opt_append=\"\${$opt_append:-} \$1\"" |
| 280 | fi |
| 281 | opt_append= |
| 282 | shift 1 |
| 283 | continue |
| 284 | fi |
| 285 | case $1 in |
| 286 | --tflite-parser) |
| 287 | flag_tflite_parser=1 |
| 288 | ;; |
| 289 | |
| 290 | --tflite-delegate) |
| 291 | flag_tflite_delegate=1 |
| 292 | ;; |
| 293 | |
| 294 | --onnx-parser) |
| 295 | flag_onnx_parser=1 |
| 296 | ;; |
| 297 | |
| 298 | --all) |
| 299 | flag_tflite_delegate=1 |
| 300 | flag_tflite_parser=1 |
| 301 | flag_onnx_parser=1 |
| 302 | ;; |
| 303 | |
| 304 | --target-arch) |
| 305 | opt_prev=target_arch |
| 306 | ;; |
| 307 | |
| 308 | --neon-backend) |
| 309 | flag_neon_backend=1 |
| 310 | ;; |
| 311 | |
| 312 | --cl-backend) |
| 313 | flag_cl_backend=1 |
| 314 | ;; |
| 315 | |
| 316 | --ref-backend) |
| 317 | flag_ref_backend=1 |
| 318 | ;; |
| 319 | |
| 320 | --clean) |
| 321 | flag_clean=1 |
| 322 | ;; |
| 323 | |
| 324 | --debug) |
| 325 | flag_debug=1 |
| 326 | ;; |
| 327 | |
| 328 | --armnn-cmake-args) |
| 329 | opt_prev=armnn_cmake_args |
| 330 | ;; |
| 331 | |
| 332 | --acl-scons-params) |
| 333 | opt_prev=acl_scons_params |
| 334 | ;; |
| 335 | |
| 336 | --num-threads) |
| 337 | opt_prev=num_threads |
| 338 | ;; |
| 339 | |
| 340 | -h | --help) |
| 341 | usage |
| 342 | exit 0 |
| 343 | ;; |
| 344 | |
| 345 | -x) |
| 346 | set -x |
| 347 | ;; |
| 348 | |
| 349 | --) |
| 350 | shift |
| 351 | break 2 |
| 352 | ;; |
| 353 | |
| 354 | esac |
| 355 | shift 1 |
| 356 | done |
| 357 | |
| 358 | # shellcheck source=common.sh |
| 359 | source "$rel_path"/common.sh |
| 360 | |
| 361 | # Validation of chosen Arm NN backends |
| 362 | if [ "$flag_neon_backend" -eq 0 ] && [ "$flag_cl_backend" -eq 0 ] && [ "$flag_ref_backend" -eq 0 ]; then |
| 363 | echo -e "\n$name: at least one of flags --neon-backend, --cl-backend or --ref-backend must be set." |
| 364 | exit 1 |
| 365 | fi |
| 366 | |
| 367 | if [ "$target_arch" == "x86_64" ]; then |
| 368 | if [ "$flag_neon_backend" -eq 1 ] || [ "$flag_cl_backend" -eq 1 ]; then |
| 369 | echo "$name: Accelerated backends --neon-backend and --cl-backend are supported on Arm targets only (x86_64 chosen)." |
| 370 | exit 1 |
| 371 | fi |
| 372 | fi |
| 373 | |
| 374 | # Verify that root source and build directories are present (post execution of setup-armnn.sh) |
| 375 | if [ ! -d "$SOURCE_DIR" ]; then |
| 376 | echo -e "\nERROR: Root source directory does not exist at $SOURCE_DIR" |
| 377 | echo "Please check that:" |
| 378 | echo "1. setup-armnn.sh was executed successfully prior to running this script" |
| 379 | echo "2. This script is being executed in the same directory as setup-armnn.sh" |
| 380 | |
| 381 | exit 1 |
| 382 | fi |
| 383 | |
| 384 | if [ ! -d "$BUILD_DIR" ]; then |
| 385 | echo -e "\nERROR: Root build directory does not exist at $BUILD_DIR" |
| 386 | echo "Please check that:" |
| 387 | echo "1. setup-armnn.sh was executed successfully prior to running this script" |
| 388 | echo "2. This script is being executed in the same directory as setup-armnn.sh" |
| 389 | |
| 390 | exit 1 |
| 391 | fi |
| 392 | |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 393 | # Download Arm NN if not done already in a previous execution of this script |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 394 | # Check if Arm NN source directory exists AND that it is a repository (not empty) |
| 395 | if [ -d "$ARMNN_SRC" ] && check_if_repository "$ARMNN_SRC"; then |
| 396 | echo -e "\n***** Arm NN source repository already located at $ARMNN_SRC. Skipping cloning of Arm NN. *****" |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 397 | else |
| 398 | # Download latest release branch of Arm NN |
| 399 | download_armnn |
| 400 | fi |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 401 | |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 402 | # Download ACL if not done already in a previous execution of this script |
| 403 | # Only download ACL if backend options --neon-backend and --cl-backend are chosen |
| 404 | if [ "$flag_neon_backend" -eq 1 ] || [ "$flag_cl_backend" -eq 1 ]; then |
| 405 | # Check if Arm NN source directory exists AND that it is a repository (not empty) |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 406 | if [ -d "$ACL_SRC" ] && check_if_repository "$ACL_SRC"; then |
| 407 | echo -e "\n***** ACL source repository already located at $ACL_SRC. Skipping cloning of ACL. *****" |
| 408 | else |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 409 | # Download latest release branch of ACL |
| 410 | download_acl |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 411 | fi |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 412 | else |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 413 | echo -e "\n***** Backend options --neon-backend and --cl-backend not selected - skipping cloning of ACL *****" |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 414 | fi |
| 415 | |
| 416 | # Adjust output build directory names for Arm NN and ACL if debug is enabled |
| 417 | DEBUG_POSTFIX="" |
| 418 | if [ "$flag_debug" -eq 1 ]; then |
| 419 | DEBUG_POSTFIX="_debug" |
| 420 | fi |
| 421 | |
James Conroy | c8d7a66 | 2022-11-18 10:17:27 +0000 | [diff] [blame] | 422 | # Replace commas with spaces in additional Arm NN / ACL build args |
| 423 | # shellcheck disable=SC2001 |
| 424 | armnn_cmake_args="$(echo "$armnn_cmake_args" | sed 's/,/ /g')" |
| 425 | |
| 426 | # shellcheck disable=SC2001 |
| 427 | acl_scons_params="$(echo "$acl_scons_params" | sed 's/,/ /g')" |
| 428 | |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 429 | # Directories for Arm NN and ACL build outputs |
| 430 | ARMNN_BUILD_ROOT="$BUILD_DIR"/armnn |
| 431 | ARMNN_BUILD_DIR_NAME="$TARGET_ARCH"_build"$DEBUG_POSTFIX" |
| 432 | ARMNN_BUILD_TARGET="$ARMNN_BUILD_ROOT"/"$ARMNN_BUILD_DIR_NAME" |
| 433 | ACL_BUILD_TARGET="$BUILD_DIR"/acl/"$TARGET_ARCH"_build"$DEBUG_POSTFIX" |
| 434 | |
| 435 | echo -e "\nINFO: Displaying configuration information before execution of $name" |
| 436 | echo " target-arch: $TARGET_ARCH" |
| 437 | echo " host-arch: $HOST_ARCH" |
| 438 | echo " tflite-delegate: $flag_tflite_delegate" |
| 439 | echo " tflite-parser: $flag_tflite_parser" |
| 440 | echo " onnx-parser: $flag_onnx_parser" |
| 441 | echo " neon-backend: $flag_neon_backend" |
| 442 | echo " cl-backend: $flag_cl_backend" |
| 443 | echo " ref-backend: $flag_ref_backend" |
| 444 | echo " clean: $flag_clean" |
| 445 | echo " debug: $flag_debug" |
| 446 | echo "armnn-cmake-args: $armnn_cmake_args" |
| 447 | echo "acl-scons-params: $acl_scons_params" |
| 448 | echo " num-threads: $NUM_THREADS" |
| 449 | echo " root directory: $ROOT_DIR" |
| 450 | echo "source directory: $SOURCE_DIR" |
| 451 | echo " build directory: $BUILD_DIR" |
| 452 | echo " armnn build dir: $ARMNN_BUILD_TARGET" |
| 453 | echo -e "\nScript execution will begin in 10 seconds..." |
| 454 | |
| 455 | sleep 10 |
| 456 | |
| 457 | if [ "$flag_neon_backend" -eq 1 ] || [ "$flag_cl_backend" -eq 1 ]; then |
| 458 | build_acl |
| 459 | else |
| 460 | echo -e "\n***** Skipping ACL build: --neon-backend and --cl-backend not set in options. *****" |
| 461 | fi |
| 462 | |
| 463 | build_armnn |
| 464 | |
| 465 | exit 0 |