blob: 8d6fb2aaf37e605621b3884e59dcebefc322a4d0 [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
9usage() {
10 echo "Usage: $CMD -g <GITHUB_USERNAME>"
11 exit 1
12}
13
14function AssertZeroExitCode {
15 EXITCODE=$?
16 if [ $EXITCODE -ne 0 ]; then
17 echo "$1"
18 echo "+++ Command exited with code $EXITCODE. Please fix the above errors and re-run"
19 exit 1
20 fi
21}
22
23# process the options given
24while getopts "g:h" opt; do
25 case "$opt" in
26 g) GITHUB_USERNAME="$OPTARG";;
27 h|\?) usage;;
28 esac
29done
30shift $((OPTIND - 1))
31
32#
33# This script is designed to be called from anywhere
34# so it will resolve where to checkout out the clframework
35# relative to its own location in armnn/scripts
36#
37SRC="${BASH_SOURCE[0]}"
38# resolve $SRC until it is no longer a symlink
39while [ -h "$SRC" ]; do
40 DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
41 SRC="$(readlink "$SRC")"
42 # if $SRC was a relative symlink, we need to resolve it
43 # relative to the path where the symlink file originally was
44 [[ $SRC != /* ]] && SRC="$DIR/$SRC"
45done
46DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
47pushd ${DIR} > /dev/null
48cd ../..
49if [ -z "$GITHUB_USERNAME" ]; then
50 GITHUB_USERNAME=$USERNAME
51 echo "setting GITHUB_USERNAME: ${GITHUB_USERNAME} use -g command line option to change"
52fi
53
54if [ ! -d clframework ]; then
55echo "+++ Cloning clframework"
56 git clone ssh://$GITHUB_USERNAME@review.mlplatform.org:29418/ml/ComputeLibrary clframework
57 AssertZeroExitCode "Cloning CL Framework failed"
58fi
59pushd clframework > /dev/null
60
61# Use the latest pinned version of the CL framework
62
63# For pinnning to a ref use this:
64# CLFRAMEWORKREVISION="branches/arm_compute_18_11" # Release 18.11
65# git fetch ssh://$GITHUB_USERNAME@review.mlplatform.org:29418/ml/ComputeLibrary $CLFRAMEWORKREVISION && git checkout FETCH_HEAD
66
67# For pinning to a revision use this:
68CLFRAMEWORKREVISION="e413d255b18fad1553bd3550a98f707c9c6e8aec" # commit on master after the fix for NEGEMMConvolutionLayer
69git fetch ssh://$GITHUB_USERNAME@review.mlplatform.org:29418/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION}
70AssertZeroExitCode
71
72# Set commit hook so we can submit reviews to gerrit
73scp -p -P 29418 $GITHUB_USERNAME@review.mlplatform.org:hooks/commit-msg .git/hooks/
74AssertZeroExitCode
75
76popd > /dev/null # out of clframework
77popd > /dev/null # back to wherever we were when called
78exit 0
79