From 34d6dd77c6767c969559bf75635144d1bfc466e7 Mon Sep 17 00:00:00 2001 From: jimfly01 Date: Thu, 15 Nov 2018 15:46:11 +0000 Subject: IVGCVSW-2115: Script to clone/fetch correct clframework * Script designed to be invoked from anywhere clones clframework relative to where the script source is located in armnn/scripts * Allows user to specify GITHUB_USERNAME on command line with -g option otherwise will set this value to $USER Change-Id: I34ee0d936152e94ff16b9bd7751c3da7248c9150 --- scripts/get_compute_library.sh | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 scripts/get_compute_library.sh diff --git a/scripts/get_compute_library.sh b/scripts/get_compute_library.sh new file mode 100755 index 0000000000..8d6fb2aaf3 --- /dev/null +++ b/scripts/get_compute_library.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# +# Copyright © 2017 Arm Ltd. All rights reserved. +# SPDX-License-Identifier: MIT +# + +CMD=$( basename $0 ) + +usage() { + echo "Usage: $CMD -g " + exit 1 +} + +function AssertZeroExitCode { + EXITCODE=$? + if [ $EXITCODE -ne 0 ]; then + echo "$1" + echo "+++ Command exited with code $EXITCODE. Please fix the above errors and re-run" + exit 1 + fi +} + +# process the options given +while getopts "g:h" opt; do + case "$opt" in + g) GITHUB_USERNAME="$OPTARG";; + h|\?) usage;; + esac +done +shift $((OPTIND - 1)) + +# +# This script is designed to be called from anywhere +# so it will resolve where to checkout out the clframework +# relative to its own location in armnn/scripts +# +SRC="${BASH_SOURCE[0]}" +# resolve $SRC until it is no longer a symlink +while [ -h "$SRC" ]; do + DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )" + SRC="$(readlink "$SRC")" + # if $SRC was a relative symlink, we need to resolve it + # relative to the path where the symlink file originally was + [[ $SRC != /* ]] && SRC="$DIR/$SRC" +done +DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )" +pushd ${DIR} > /dev/null +cd ../.. +if [ -z "$GITHUB_USERNAME" ]; then + GITHUB_USERNAME=$USERNAME + echo "setting GITHUB_USERNAME: ${GITHUB_USERNAME} use -g command line option to change" +fi + +if [ ! -d clframework ]; then +echo "+++ Cloning clframework" + git clone ssh://$GITHUB_USERNAME@review.mlplatform.org:29418/ml/ComputeLibrary clframework + AssertZeroExitCode "Cloning CL Framework failed" +fi +pushd clframework > /dev/null + +# Use the latest pinned version of the CL framework + +# For pinnning to a ref use this: +# CLFRAMEWORKREVISION="branches/arm_compute_18_11" # Release 18.11 +# git fetch ssh://$GITHUB_USERNAME@review.mlplatform.org:29418/ml/ComputeLibrary $CLFRAMEWORKREVISION && git checkout FETCH_HEAD + +# For pinning to a revision use this: +CLFRAMEWORKREVISION="e413d255b18fad1553bd3550a98f707c9c6e8aec" # commit on master after the fix for NEGEMMConvolutionLayer +git fetch ssh://$GITHUB_USERNAME@review.mlplatform.org:29418/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION} +AssertZeroExitCode + +# Set commit hook so we can submit reviews to gerrit +scp -p -P 29418 $GITHUB_USERNAME@review.mlplatform.org:hooks/commit-msg .git/hooks/ +AssertZeroExitCode + +popd > /dev/null # out of clframework +popd > /dev/null # back to wherever we were when called +exit 0 + -- cgit v1.2.1