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 | |
James Conroy | 3106c7f | 2022-12-07 10:30:19 +0000 | [diff] [blame] | 129 | # Copy Arm NN include directory into build output |
| 130 | cd "$ARMNN_BUILD_TARGET" |
| 131 | rm -rf include |
| 132 | cp -r "$SOURCE_DIR"/armnn/include . |
| 133 | |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 134 | echo -e "\n***** Built Arm NN for $TARGET_ARCH *****" |
| 135 | |
| 136 | local tarball_path="$ROOT_DIR/armnn_$ARMNN_BUILD_DIR_NAME.tar.gz" |
| 137 | echo -e "\n***** Creating tarball of Arm NN build at $tarball_path *****" |
| 138 | |
| 139 | cd "$ARMNN_BUILD_ROOT" |
| 140 | rm -f "$tarball_path" |
| 141 | tar -czf "$tarball_path" "$ARMNN_BUILD_DIR_NAME" |
| 142 | |
| 143 | echo -e "\n***** Created tarball of Arm NN build at $ROOT_DIR/armnn_$ARMNN_BUILD_DIR_NAME.tar.gz *****" |
| 144 | echo -e "\n***** To extract tarball, run: tar -xzf armnn_$ARMNN_BUILD_DIR_NAME.tar.gz *****\n" |
| 145 | |
| 146 | return 0 |
| 147 | } |
| 148 | |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 149 | download_armnn() |
| 150 | { |
| 151 | cd "$SOURCE_DIR" |
| 152 | |
| 153 | echo -e "\n***** Downloading Arm NN *****" |
| 154 | |
| 155 | rm -rf "$ARMNN_SRC" |
| 156 | |
| 157 | # Latest release branch of Arm NN is checked out by default |
| 158 | git clone https://github.com/ARM-software/armnn.git armnn |
| 159 | |
| 160 | cd "$ARMNN_SRC" |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 161 | local armnn_branch="$(git rev-parse --abbrev-ref HEAD)" |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 162 | |
| 163 | echo -e "\n***** Arm NN Downloaded: $armnn_branch *****" |
| 164 | } |
| 165 | |
| 166 | download_acl() |
| 167 | { |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 168 | # First get Arm NN branch so that we can download corresponding ACL tag |
| 169 | cd "$ARMNN_SRC" |
| 170 | local armnn_branch="$(git rev-parse --abbrev-ref HEAD)" |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 171 | |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 172 | echo -e "\n***** Downloading corresponding ACL version using Arm NN branch: $armnn_branch *****" |
| 173 | |
| 174 | cd "$SOURCE_DIR" |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 175 | |
| 176 | rm -rf "$ACL_SRC" |
| 177 | |
| 178 | git clone https://github.com/ARM-software/ComputeLibrary.git acl |
| 179 | |
| 180 | # Get corresponding release tag for ACL by parsing release branch number for Arm NN |
| 181 | local acl_tag="" |
| 182 | acl_tag="$(echo "$armnn_branch" | tr '\n' ' ' | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g' | tr -s ' ' | sed 's/ /./g')" |
| 183 | |
| 184 | cd "$ACL_SRC" |
| 185 | git checkout v"$acl_tag" |
| 186 | |
| 187 | echo -e "\n***** ACL Downloaded: $acl_tag *****" |
| 188 | } |
| 189 | |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 190 | usage() |
| 191 | { |
| 192 | cat <<EOF |
| 193 | build-armnn.sh - Build Arm NN and ACL |
| 194 | build-armnn.sh [OPTION]... |
| 195 | --tflite-delegate |
| 196 | build the Arm NN TF Lite Delegate component |
| 197 | --tflite-parser |
| 198 | build the Arm NN TF Lite Parser component |
| 199 | --onnx-parser |
| 200 | build the Arm NN ONNX parser component |
| 201 | --all |
| 202 | build all Arm NN components listed above |
James Conroy | e6f30ad | 2022-09-08 12:04:26 +0100 | [diff] [blame] | 203 | --target-arch=[aarch64|x86_64] |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 204 | specify a target architecture (mandatory) |
| 205 | --neon-backend |
| 206 | build Arm NN with the NEON backend (CPU acceleration from ACL) |
| 207 | --cl-backend |
| 208 | build Arm NN with the OpenCL backend (GPU acceleration from ACL) |
| 209 | --ref-backend |
| 210 | build Arm NN with the reference backend (Should be used for verification purposes only. Does not provide any performance acceleration.) |
| 211 | --clean |
| 212 | remove previous Arm NN and ACL build prior to script execution (optional: defaults to off) |
| 213 | --debug |
| 214 | build Arm NN (and ACL) with debug turned on (optional: defaults to off) |
| 215 | --armnn-cmake-args=<ARG LIST STRING> |
James Conroy | c8d7a66 | 2022-11-18 10:17:27 +0000 | [diff] [blame] | 216 | provide additional comma-separated CMake arguments string for building Arm NN (optional) |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 217 | --acl-scons-params=<PARAM LIST STRING> |
James Conroy | c8d7a66 | 2022-11-18 10:17:27 +0000 | [diff] [blame] | 218 | provide additional comma-separated scons parameters string for building ACL (optional) |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 219 | --num-threads=<INTEGER> |
| 220 | specify number of threads/cores to build dependencies with (optional: defaults to number of online CPU cores on host) |
| 221 | -h, --help |
| 222 | print brief usage information and exit |
| 223 | -x |
| 224 | enable shell tracing in this script |
| 225 | |
| 226 | 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. |
| 227 | At least one backend (i.e. --neon-backend, --cl-backend, --ref-backend) must be chosen. |
| 228 | This script must be executed from the same root directory in which setup-armnn.sh was executed from. |
| 229 | |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 230 | 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] | 231 | Alternatively, place custom/modified repositories named "armnn" and (optionally) "acl" in <ROOT_DIR>/source. |
| 232 | 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] | 233 | |
| 234 | 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. |
| 235 | |
| 236 | Examples: |
| 237 | Build for aarch64 with all Arm NN components, NEON enabled and OpenCL enabled: |
| 238 | <PATH_TO>/build-armnn.sh --target-arch=aarch64 --all --neon-backend --cl-backend |
| 239 | 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] | 240 | <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] | 241 | 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] | 242 | <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] | 243 | EOF |
| 244 | } |
| 245 | |
| 246 | # This will catch in validation.sh if not set |
| 247 | target_arch="" |
| 248 | |
| 249 | # Default flag values |
| 250 | flag_tflite_delegate=0 |
| 251 | flag_tflite_parser=0 |
| 252 | flag_onnx_parser=0 |
| 253 | flag_neon_backend=0 |
| 254 | flag_cl_backend=0 |
| 255 | flag_ref_backend=0 |
| 256 | flag_clean=0 |
| 257 | flag_debug=0 |
| 258 | |
| 259 | # Empty strings for optional additional args by default |
| 260 | armnn_cmake_args="" |
| 261 | acl_scons_params="" |
| 262 | |
| 263 | # If --num-threads is not set, the default NUM_THREADS value in common.sh will be used |
| 264 | num_threads=0 |
| 265 | |
| 266 | name=$(basename "$0") |
| 267 | |
| 268 | # If no options provided, show help |
| 269 | if [ $# -eq 0 ]; then |
| 270 | usage |
| 271 | exit 1 |
| 272 | fi |
| 273 | |
| 274 | 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" -- "$@") |
| 275 | eval set -- "$args" |
| 276 | while [ $# -gt 0 ]; do |
| 277 | if [ -n "${opt_prev:-}" ]; then |
| 278 | eval "$opt_prev=\$1" |
| 279 | opt_prev= |
| 280 | shift 1 |
| 281 | continue |
| 282 | elif [ -n "${opt_append:-}" ]; then |
| 283 | if [ -n "$1" ]; then |
| 284 | eval "$opt_append=\"\${$opt_append:-} \$1\"" |
| 285 | fi |
| 286 | opt_append= |
| 287 | shift 1 |
| 288 | continue |
| 289 | fi |
| 290 | case $1 in |
| 291 | --tflite-parser) |
| 292 | flag_tflite_parser=1 |
| 293 | ;; |
| 294 | |
| 295 | --tflite-delegate) |
| 296 | flag_tflite_delegate=1 |
| 297 | ;; |
| 298 | |
| 299 | --onnx-parser) |
| 300 | flag_onnx_parser=1 |
| 301 | ;; |
| 302 | |
| 303 | --all) |
| 304 | flag_tflite_delegate=1 |
| 305 | flag_tflite_parser=1 |
| 306 | flag_onnx_parser=1 |
| 307 | ;; |
| 308 | |
| 309 | --target-arch) |
| 310 | opt_prev=target_arch |
| 311 | ;; |
| 312 | |
| 313 | --neon-backend) |
| 314 | flag_neon_backend=1 |
| 315 | ;; |
| 316 | |
| 317 | --cl-backend) |
| 318 | flag_cl_backend=1 |
| 319 | ;; |
| 320 | |
| 321 | --ref-backend) |
| 322 | flag_ref_backend=1 |
| 323 | ;; |
| 324 | |
| 325 | --clean) |
| 326 | flag_clean=1 |
| 327 | ;; |
| 328 | |
| 329 | --debug) |
| 330 | flag_debug=1 |
| 331 | ;; |
| 332 | |
| 333 | --armnn-cmake-args) |
| 334 | opt_prev=armnn_cmake_args |
| 335 | ;; |
| 336 | |
| 337 | --acl-scons-params) |
| 338 | opt_prev=acl_scons_params |
| 339 | ;; |
| 340 | |
| 341 | --num-threads) |
| 342 | opt_prev=num_threads |
| 343 | ;; |
| 344 | |
| 345 | -h | --help) |
| 346 | usage |
| 347 | exit 0 |
| 348 | ;; |
| 349 | |
| 350 | -x) |
| 351 | set -x |
| 352 | ;; |
| 353 | |
| 354 | --) |
| 355 | shift |
| 356 | break 2 |
| 357 | ;; |
| 358 | |
| 359 | esac |
| 360 | shift 1 |
| 361 | done |
| 362 | |
| 363 | # shellcheck source=common.sh |
| 364 | source "$rel_path"/common.sh |
| 365 | |
| 366 | # Validation of chosen Arm NN backends |
| 367 | if [ "$flag_neon_backend" -eq 0 ] && [ "$flag_cl_backend" -eq 0 ] && [ "$flag_ref_backend" -eq 0 ]; then |
| 368 | echo -e "\n$name: at least one of flags --neon-backend, --cl-backend or --ref-backend must be set." |
| 369 | exit 1 |
| 370 | fi |
| 371 | |
| 372 | if [ "$target_arch" == "x86_64" ]; then |
| 373 | if [ "$flag_neon_backend" -eq 1 ] || [ "$flag_cl_backend" -eq 1 ]; then |
| 374 | echo "$name: Accelerated backends --neon-backend and --cl-backend are supported on Arm targets only (x86_64 chosen)." |
| 375 | exit 1 |
| 376 | fi |
| 377 | fi |
| 378 | |
| 379 | # Verify that root source and build directories are present (post execution of setup-armnn.sh) |
| 380 | if [ ! -d "$SOURCE_DIR" ]; then |
| 381 | echo -e "\nERROR: Root source directory does not exist at $SOURCE_DIR" |
| 382 | echo "Please check that:" |
| 383 | echo "1. setup-armnn.sh was executed successfully prior to running this script" |
| 384 | echo "2. This script is being executed in the same directory as setup-armnn.sh" |
| 385 | |
| 386 | exit 1 |
| 387 | fi |
| 388 | |
| 389 | if [ ! -d "$BUILD_DIR" ]; then |
| 390 | echo -e "\nERROR: Root build directory does not exist at $BUILD_DIR" |
| 391 | echo "Please check that:" |
| 392 | echo "1. setup-armnn.sh was executed successfully prior to running this script" |
| 393 | echo "2. This script is being executed in the same directory as setup-armnn.sh" |
| 394 | |
| 395 | exit 1 |
| 396 | fi |
| 397 | |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 398 | # 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] | 399 | # Check if Arm NN source directory exists AND that it is a repository (not empty) |
| 400 | if [ -d "$ARMNN_SRC" ] && check_if_repository "$ARMNN_SRC"; then |
| 401 | 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] | 402 | else |
| 403 | # Download latest release branch of Arm NN |
| 404 | download_armnn |
| 405 | fi |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 406 | |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 407 | # Download ACL if not done already in a previous execution of this script |
| 408 | # Only download ACL if backend options --neon-backend and --cl-backend are chosen |
| 409 | if [ "$flag_neon_backend" -eq 1 ] || [ "$flag_cl_backend" -eq 1 ]; then |
| 410 | # 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] | 411 | if [ -d "$ACL_SRC" ] && check_if_repository "$ACL_SRC"; then |
| 412 | echo -e "\n***** ACL source repository already located at $ACL_SRC. Skipping cloning of ACL. *****" |
| 413 | else |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 414 | # Download latest release branch of ACL |
| 415 | download_acl |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 416 | fi |
James Conroy | 210897d | 2022-08-04 16:55:05 +0100 | [diff] [blame] | 417 | else |
James Conroy | c4fbbec | 2022-09-22 16:40:00 +0100 | [diff] [blame] | 418 | 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] | 419 | fi |
| 420 | |
| 421 | # Adjust output build directory names for Arm NN and ACL if debug is enabled |
| 422 | DEBUG_POSTFIX="" |
| 423 | if [ "$flag_debug" -eq 1 ]; then |
| 424 | DEBUG_POSTFIX="_debug" |
| 425 | fi |
| 426 | |
James Conroy | c8d7a66 | 2022-11-18 10:17:27 +0000 | [diff] [blame] | 427 | # Replace commas with spaces in additional Arm NN / ACL build args |
| 428 | # shellcheck disable=SC2001 |
| 429 | armnn_cmake_args="$(echo "$armnn_cmake_args" | sed 's/,/ /g')" |
| 430 | |
| 431 | # shellcheck disable=SC2001 |
| 432 | acl_scons_params="$(echo "$acl_scons_params" | sed 's/,/ /g')" |
| 433 | |
James Conroy | 919ec71 | 2022-07-13 12:57:53 +0100 | [diff] [blame] | 434 | # Directories for Arm NN and ACL build outputs |
| 435 | ARMNN_BUILD_ROOT="$BUILD_DIR"/armnn |
| 436 | ARMNN_BUILD_DIR_NAME="$TARGET_ARCH"_build"$DEBUG_POSTFIX" |
| 437 | ARMNN_BUILD_TARGET="$ARMNN_BUILD_ROOT"/"$ARMNN_BUILD_DIR_NAME" |
| 438 | ACL_BUILD_TARGET="$BUILD_DIR"/acl/"$TARGET_ARCH"_build"$DEBUG_POSTFIX" |
| 439 | |
| 440 | echo -e "\nINFO: Displaying configuration information before execution of $name" |
| 441 | echo " target-arch: $TARGET_ARCH" |
| 442 | echo " host-arch: $HOST_ARCH" |
| 443 | echo " tflite-delegate: $flag_tflite_delegate" |
| 444 | echo " tflite-parser: $flag_tflite_parser" |
| 445 | echo " onnx-parser: $flag_onnx_parser" |
| 446 | echo " neon-backend: $flag_neon_backend" |
| 447 | echo " cl-backend: $flag_cl_backend" |
| 448 | echo " ref-backend: $flag_ref_backend" |
| 449 | echo " clean: $flag_clean" |
| 450 | echo " debug: $flag_debug" |
| 451 | echo "armnn-cmake-args: $armnn_cmake_args" |
| 452 | echo "acl-scons-params: $acl_scons_params" |
| 453 | echo " num-threads: $NUM_THREADS" |
| 454 | echo " root directory: $ROOT_DIR" |
| 455 | echo "source directory: $SOURCE_DIR" |
| 456 | echo " build directory: $BUILD_DIR" |
| 457 | echo " armnn build dir: $ARMNN_BUILD_TARGET" |
| 458 | echo -e "\nScript execution will begin in 10 seconds..." |
| 459 | |
| 460 | sleep 10 |
| 461 | |
| 462 | if [ "$flag_neon_backend" -eq 1 ] || [ "$flag_cl_backend" -eq 1 ]; then |
| 463 | build_acl |
| 464 | else |
| 465 | echo -e "\n***** Skipping ACL build: --neon-backend and --cl-backend not set in options. *****" |
| 466 | fi |
| 467 | |
| 468 | build_armnn |
| 469 | |
| 470 | exit 0 |