aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Conroy <james.conroy@arm.com>2022-09-22 16:40:00 +0100
committerJames Conroy <james.conroy@arm.com>2022-10-24 11:03:48 +0000
commitc4fbbec63979d99d6cc722aa848896880cc266ec (patch)
treeb10481770dc14ce763b70f36c3a98eadb55a4696
parent88b902543ded6cf991fee3776f22040240683df4 (diff)
downloadarmnn-c4fbbec63979d99d6cc722aa848896880cc266ec.tar.gz
Make it optional to provide custom ACL to build-tool
* Currently, the build-tool requires the user provide both Arm NN and ACL repos, if providing custom repos. * This change allows the user to provide only a custom Arm NN repo, making a custom ACL optional in the case of --neon-backend or --cl-backend not being chosen in BUILD_ARGS. * Updated script help/usage and docs to reflect this. Signed-off-by: James Conroy <james.conroy@arm.com> Change-Id: I821f07dcd4c32ada60cd33713234b47c330d217e
-rw-r--r--build-tool/README.md8
-rw-r--r--build-tool/docker/Dockerfile3
-rwxr-xr-xbuild-tool/scripts/build-armnn.sh33
3 files changed, 28 insertions, 16 deletions
diff --git a/build-tool/README.md b/build-tool/README.md
index a5f946756d..b56a6907c5 100644
--- a/build-tool/README.md
+++ b/build-tool/README.md
@@ -305,9 +305,10 @@ sudo ./install-packages.sh
### Use custom Arm NN and ACL repository versions during build
By default, the docker build process (specifically, during ```build-armnn.sh```) will download the latest release versions of Arm NN and ACL.
-If you'd like to use different versions during the build, check them out in the ```build-tool``` directory on the host (both must be provided).<br>
+If you'd like to use different versions during the build, check them out in the ```build-tool``` directory on the host.<br>
When providing custom repositories, the following ```docker build``` argument must be provided ```--build-arg BUILD_TYPE=dev```.
-This will trigger Docker to copy the custom repos into the Docker Image during build.
+This will trigger Docker to copy the custom repos into the Docker Image during build. The ACL repo is only required if
+supplying the ```--neon-backend``` or ```--cl-backend``` BUILD_ARGS options.
**Note:** the Arm NN version used for build-tool (Dockerfile and scripts) is not the same version of Arm NN that is used during the build.
This means that separate versions of Arm NN can be used for the build-tool and for building Arm NN itself.<br>
@@ -321,13 +322,14 @@ git checkout <branch or SHA>
cd ..
+# custom ACL repo only required when supplying --neon-backend or --cl-backend BUILD_ARGS options
git clone https://github.com/ARM-software/ComputeLibrary.git acl
cd acl
git checkout <tag or SHA>
cd ..
-# Example docker build with BUILD_TYPE=dev
+# Example docker build with BUILD_TYPE=dev, ran inside the build-tool directory
docker build \
--build-arg BUILD_TYPE=dev \
--build-arg SETUP_ARGS="--target-arch=aarch64 --all" \
diff --git a/build-tool/docker/Dockerfile b/build-tool/docker/Dockerfile
index d1f212c684..21020545f1 100644
--- a/build-tool/docker/Dockerfile
+++ b/build-tool/docker/Dockerfile
@@ -62,7 +62,8 @@ FROM build-production as build-dev
RUN mkdir -p source/armnn source/acl
# Copy custom armnn/acl source repos from the build-tool directory on the host, if they exist (optional)
-# If repos not provided, the build-armnn.sh script will automatically download the latest release branches of Arm NN and ACL
+# The 'acl' repo must be provided if --neon-backend or --cl-backend is given in the BUILD_ARGS, otherwise only custom "armnn" is required
+# If custom repos not provided, the build-armnn.sh script will automatically download the latest release branches of Arm NN and ACL
# Copies Dockerfile to ensure COPY works - at least one file must exist for COPY to work
COPY --chown=arm-user:arm-user ./docker/Dockerfile ./armnn* ./source/armnn/
COPY --chown=arm-user:arm-user ./docker/Dockerfile ./acl* ./source/acl/
diff --git a/build-tool/scripts/build-armnn.sh b/build-tool/scripts/build-armnn.sh
index 10f41e8cc7..c0e4f93277 100755
--- a/build-tool/scripts/build-armnn.sh
+++ b/build-tool/scripts/build-armnn.sh
@@ -153,16 +153,20 @@ download_armnn()
git clone https://github.com/ARM-software/armnn.git armnn
cd "$ARMNN_SRC"
- armnn_branch="$(git rev-parse --abbrev-ref HEAD)"
+ local armnn_branch="$(git rev-parse --abbrev-ref HEAD)"
echo -e "\n***** Arm NN Downloaded: $armnn_branch *****"
}
download_acl()
{
- cd "$SOURCE_DIR"
+ # First get Arm NN branch so that we can download corresponding ACL tag
+ cd "$ARMNN_SRC"
+ local armnn_branch="$(git rev-parse --abbrev-ref HEAD)"
- echo -e "\n***** Downloading ACL *****"
+ echo -e "\n***** Downloading corresponding ACL version using Arm NN branch: $armnn_branch *****"
+
+ cd "$SOURCE_DIR"
rm -rf "$ACL_SRC"
@@ -219,8 +223,8 @@ At least one backend (i.e. --neon-backend, --cl-backend, --ref-backend) must be
This script must be executed from the same root directory in which setup-armnn.sh was executed from.
The first execution of this script will download the latest release branches of Arm NN and ACL, by default.
-Alternatively, place custom/modified repositories named "armnn" and "acl" in <ROOT_DIR>/source.
-If providing custom repos, both Arm NN and ACL must be provided. The ACL repo will not be used if flags --neon-backend or --cl-backend are not selected.
+Alternatively, place custom/modified repositories named "armnn" and (optionally) "acl" in <ROOT_DIR>/source.
+Providing custom "acl" repo is optional since it is only required if backend flags --neon-backend or --cl-backend are chosen.
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.
@@ -386,22 +390,27 @@ if [ ! -d "$BUILD_DIR" ]; then
exit 1
fi
-# Download Arm NN and ACL if not done already in a previous execution of this script
+# Download Arm NN if not done already in a previous execution of this script
# Check if Arm NN source directory exists AND that it is a repository (not empty)
if [ -d "$ARMNN_SRC" ] && check_if_repository "$ARMNN_SRC"; then
echo -e "\n***** Arm NN source repository already located at $ARMNN_SRC. Skipping cloning of Arm NN. *****"
+else
+ # Download latest release branch of Arm NN
+ download_armnn
+fi
- # ACL repo must also be present if Arm NN repo is present
+# Download ACL if not done already in a previous execution of this script
+# Only download ACL if backend options --neon-backend and --cl-backend are chosen
+if [ "$flag_neon_backend" -eq 1 ] || [ "$flag_cl_backend" -eq 1 ]; then
+ # Check if Arm NN source directory exists AND that it is a repository (not empty)
if [ -d "$ACL_SRC" ] && check_if_repository "$ACL_SRC"; then
echo -e "\n***** ACL source repository already located at $ACL_SRC. Skipping cloning of ACL. *****"
else
- echo -e "\nERROR: ACL source repository must be provided at $ACL_SRC if Arm NN source is provided. *****"
- exit 1
+ # Download latest release branch of ACL
+ download_acl
fi
else
- # Download latest release branches of Arm NN and ACL
- download_armnn
- download_acl
+ echo -e "\n***** Backend options --neon-backend and --cl-backend not selected - skipping cloning of ACL *****"
fi
# Adjust output build directory names for Arm NN and ACL if debug is enabled