blob: 3fa25febe7c967dda40b7a5f2bf5227f2961dc41 [file] [log] [blame]
jimfly0134d6dd72018-11-15 15:46:11 +00001#!/bin/bash
2#
3# Copyright © 2017 Arm Ltd. All rights reserved.
4# SPDX-License-Identifier: MIT
5#
6
7CMD=$( basename $0 )
8
Francis Murtagh842e0db2020-01-09 14:24:11 +00009# For pinning to a ref use this:
Jim Flynneed03042021-07-05 18:15:03 +010010DEFAULT_CLFRAMEWORKREVISION="dev/21_02_int8_optim" # the 21.02 ACL development branch with the int8 performance fixes
Jim Flynn82fbe7c2019-04-02 15:19:08 +010011#
12# For pinning to a revision use this:
Nikhil Raj16f72f52021-02-15 12:10:57 +000013#DEFAULT_CLFRAMEWORKREVISION="8958167c8d609566a40c9e618158ebcbdcd3e3bb" #Building android-nn-driver failed
Jim Flynn82fbe7c2019-04-02 15:19:08 +010014
jimfly0134d6dd72018-11-15 15:46:11 +000015usage() {
Jim Flynn82fbe7c2019-04-02 15:19:08 +010016 echo "Usage: $CMD (Use the default clframework SHA)"
17 echo "Usage: $CMD -s <CLFRAMEWORK_SHA>"
18 echo "Usage: $CMD -p (Print current default clframework SHA)"
Jim Flynn774f6f12019-04-11 13:10:46 +010019 exit 0
jimfly0134d6dd72018-11-15 15:46:11 +000020}
21
Jim Flynn82fbe7c2019-04-02 15:19:08 +010022PrintDefaultClframeworkSha() {
23 echo $DEFAULT_CLFRAMEWORKREVISION
Jim Flynn774f6f12019-04-11 13:10:46 +010024 exit 0;
Jim Flynn82fbe7c2019-04-02 15:19:08 +010025}
26
jimfly0134d6dd72018-11-15 15:46:11 +000027function AssertZeroExitCode {
28 EXITCODE=$?
29 if [ $EXITCODE -ne 0 ]; then
30 echo "$1"
31 echo "+++ Command exited with code $EXITCODE. Please fix the above errors and re-run"
32 exit 1
33 fi
34}
35
36# process the options given
Jim Flynn82fbe7c2019-04-02 15:19:08 +010037while getopts "s:phg:" opt; do
jimfly0134d6dd72018-11-15 15:46:11 +000038 case "$opt" in
Jim Flynn82fbe7c2019-04-02 15:19:08 +010039 s) CLFRAMEWORK_SHA="$OPTARG";;
40 p) PrintDefaultClframeworkSha;;
41 g) DUMMY="$OPTARG";; # continue to accept -g for backward compatibility
jimfly0134d6dd72018-11-15 15:46:11 +000042 h|\?) usage;;
43 esac
44done
45shift $((OPTIND - 1))
46
47#
48# This script is designed to be called from anywhere
49# so it will resolve where to checkout out the clframework
50# relative to its own location in armnn/scripts
51#
52SRC="${BASH_SOURCE[0]}"
53# resolve $SRC until it is no longer a symlink
54while [ -h "$SRC" ]; do
55 DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
56 SRC="$(readlink "$SRC")"
57 # if $SRC was a relative symlink, we need to resolve it
58 # relative to the path where the symlink file originally was
59 [[ $SRC != /* ]] && SRC="$DIR/$SRC"
60done
61DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
62pushd ${DIR} > /dev/null
63cd ../..
jimfly0134d6dd72018-11-15 15:46:11 +000064
65if [ ! -d clframework ]; then
Matthew Bentham6e2f6062019-01-23 15:23:13 +000066 git clone https://review.mlplatform.org/ml/ComputeLibrary clframework
jimfly0134d6dd72018-11-15 15:46:11 +000067 AssertZeroExitCode "Cloning CL Framework failed"
68fi
69pushd clframework > /dev/null
70
Jim Flynn82fbe7c2019-04-02 15:19:08 +010071CLFRAMEWORKREVISION=$DEFAULT_CLFRAMEWORKREVISION
72if [ ! -z "$CLFRAMEWORK_SHA" ]; then
73 CLFRAMEWORKREVISION=$CLFRAMEWORK_SHA
74fi
jimfly0134d6dd72018-11-15 15:46:11 +000075
Matteo Martincighc1001c62019-05-23 16:03:55 +010076git fetch && git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION}
Jim Flynn82fbe7c2019-04-02 15:19:08 +010077AssertZeroExitCode "Fetching and checking out ${CLFRAMEWORKREVISION} failed"
jimfly0134d6dd72018-11-15 15:46:11 +000078
79# Set commit hook so we can submit reviews to gerrit
Matthew Bentham6e2f6062019-01-23 15:23:13 +000080(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)
Jim Flynn82fbe7c2019-04-02 15:19:08 +010081AssertZeroExitCode "Setting commit hooks failed"
jimfly0134d6dd72018-11-15 15:46:11 +000082
83popd > /dev/null # out of clframework
84popd > /dev/null # back to wherever we were when called
Jim Flynn82fbe7c2019-04-02 15:19:08 +010085# Make sure the SHA of the revision that was checked out is the last line
86# of output from the script... just in case we ever need it.
87echo $CLFRAMEWORKREVISION
jimfly0134d6dd72018-11-15 15:46:11 +000088exit 0