From ae14eba9f9b771600afa3f00fef34bfa60cc7c91 Mon Sep 17 00:00:00 2001 From: James Conroy Date: Tue, 30 Aug 2022 12:23:11 +0100 Subject: IVGCVSW-7201 Generalize get_compute_library.sh usage * Allow user-specified directory name for the ACL repo (other than 'clframework') with the '-n' option. * Fix indentation. Signed-off-by: James Conroy Change-Id: Iadec158bd9469fbc0d0875b085a5702e4a89ae83 --- scripts/get_compute_library.sh | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/scripts/get_compute_library.sh b/scripts/get_compute_library.sh index 63209bf118..0788cd5f95 100755 --- a/scripts/get_compute_library.sh +++ b/scripts/get_compute_library.sh @@ -10,12 +10,20 @@ CMD=$( basename "$0" ) #DEFAULT_CLFRAMEWORKREVISION="branches/arm_compute_22_08" # Release 22.08 # # For pinning to a revision use this: -DEFAULT_CLFRAMEWORKREVISION="a331e48ad8a4856837cf0afdd44de69af43581af" #Fix add for tensors with non-matching strides +DEFAULT_CLFRAMEWORKREVISION="552fe4c67d3cd2994cdbd5662cde79da5caf0c4d" #F16 Specialization for MeanStdDevNorm usage() { - echo "Usage: $CMD (Use the default clframework SHA)" - echo "Usage: $CMD -s " - echo "Usage: $CMD -p (Print current default clframework SHA)" + echo -e "get_compute_library.sh: Clones the Arm Compute Library (ACL) repo from the ML Platform server and checks out + the pinned version of ACL based on the SHA string defined at the top of this script (DEFAULT_CLFRAMEWORKREVISION). + If the ACL repo already exists, this script will skip cloning and only checkout the relevant SHA. + The pinned ACL version is a known version that works correctly with the version of Arm NN being used. This pin is + regularly updated by the Arm NN team on the Arm NN 'main' branch. + During release periods, the ACL pin will point to an ACL release branch which exists on the ML Platform server. + The repo directory will be named 'clframework' unless defined by the '-n' argument to this script.\n" + echo "Usage: $CMD (Use the default clframework SHA)" + echo "Usage: $CMD -s " + echo "Usage: $CMD -p (Print current default clframework SHA)" + echo "Usage: $CMD -n Name of the directory into which the ACL repo will be cloned, default is 'clframework'" exit 0 } @@ -34,10 +42,11 @@ function AssertZeroExitCode { } # process the options given -while getopts "s:ph" opt; do +while getopts "s:n:ph" opt; do case "$opt" in s) CLFRAMEWORK_SHA="$OPTARG";; p) PrintDefaultClframeworkSha;; + n) ACL_REPO_NAME_OPTION="$OPTARG";; h|\?) usage;; esac done @@ -62,24 +71,33 @@ pushd "${DIR}" > /dev/null # shellcheck disable=SC2164 cd ../.. -if [ ! -d clframework ]; then - git clone https://review.mlplatform.org/ml/ComputeLibrary clframework +# Default ACL repo directory name is 'clframework' +# This can be overwritten by command line option '-n' +ACL_REPO_NAMFE="clframework" +if [ ! -z "$ACL_REPO_NAME_OPTION" ]; then + ACL_REPO_NAME="$ACL_REPO_NAME_OPTION" +fi + +if [ ! -d "$ACL_REPO_NAME" ]; then + echo "Cloning CL Framework" + git clone https://review.mlplatform.org/ml/ComputeLibrary "$ACL_REPO_NAME" AssertZeroExitCode "Cloning CL Framework failed" fi -pushd clframework > /dev/null +pushd "$ACL_REPO_NAME" > /dev/null CLFRAMEWORKREVISION=$DEFAULT_CLFRAMEWORKREVISION if [ ! -z "$CLFRAMEWORK_SHA" ]; then - CLFRAMEWORKREVISION=$CLFRAMEWORK_SHA + CLFRAMEWORKREVISION=$CLFRAMEWORK_SHA fi +echo "git fetch && git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout $CLFRAMEWORKREVISION" git fetch && git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout "${CLFRAMEWORKREVISION}" AssertZeroExitCode "Fetching and checking out ${CLFRAMEWORKREVISION} failed" # If the target ACL revision includes a branch we also need to do a pull. # This generally occurs with a release branch. if [[ "${CLFRAMEWORKREVISION}" == *"branches"* ]]; then - git pull - AssertZeroExitCode "ACL reference includes a branch but git pull failed." + git pull + AssertZeroExitCode "ACL reference includes a branch but git pull failed." fi # Set commit hook so we can submit reviews to gerrit @@ -87,7 +105,7 @@ fi (curl -Lo "$(git rev-parse --git-dir)"/hooks/commit-msg https://review.mlplatform.org/tools/hooks/commit-msg; chmod +x "$(git rev-parse --git-dir)"/hooks/commit-msg) AssertZeroExitCode "Setting commit hooks failed" -popd > /dev/null # out of clframework +popd > /dev/null # out of clframework / "$ACL_REPO_NAME" popd > /dev/null # back to wherever we were when called # Make sure the SHA of the revision that was checked out is the last line # of output from the script... just in case we ever need it. -- cgit v1.2.1