-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcompare-git-hashes.sh
executable file
·89 lines (76 loc) · 2.65 KB
/
compare-git-hashes.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash -e
usage() {
echo "=====!!!WARNING!!!===="
echo "This will clean all repos involved! Use only on a clean checkout."
echo "$0 \"<arguments to runPerformanceTests.py>\" <reference-cmdstan-git-hash> <cmdstan_pr_or_hash> <stan_pr> <math_pr> <stanc3_bin_url>"
}
write_makelocal() {
echo "Writing to make/local, stanc3 binary url $1"
echo -e "CXXFLAGS += -march=native \n${1}" > make/local
}
clean_checkout() {
make revert
cd cmdstan
#Checkout CmdStan
if [[ "$1" == "PR-"* ]] ; then
prNumber=$(echo $1 | cut -d "-" -f 2)
git fetch https://github.com/stan-dev/cmdstan +refs/pull/$prNumber/merge:refs/remotes/origin/pr/$prNumber/merge
git checkout refs/remotes/origin/pr/$prNumber/merge
else
git fetch && git checkout "$1" && git pull origin "$1"
fi
git reset --hard HEAD
git clean -xffd
git submodule update --init --recursive
#Checkout stan
cd stan
if [[ "$2" == "PR-"* ]] ; then
prNumber=$(echo $2 | cut -d "-" -f 2)
git fetch https://github.com/stan-dev/stan +refs/pull/$prNumber/merge:refs/remotes/origin/pr/$prNumber/merge
git checkout refs/remotes/origin/pr/$prNumber/merge
elif [ "$2" != "false" ] ; then
git fetch && git checkout "$2" && git pull origin "$2"
fi
git reset --hard HEAD
git clean -xffd
cd ..
#Checkout math
pushd stan/lib/stan_math
if [[ "$3" == "PR-"* ]] ; then
prNumber=$(echo $3 | cut -d "-" -f 2)
git fetch https://github.com/stan-dev/math +refs/pull/$prNumber/merge:refs/remotes/origin/pr/$prNumber/merge
git checkout refs/remotes/origin/pr/$prNumber/merge
elif [ "$3" != "false" ] ; then
git fetch && git checkout "$3" && git pull origin "$3"
fi
git reset --hard HEAD
git clean -xffd
popd
cd ..
make clean
cd cmdstan
dirty=$(git status --porcelain)
#if [ "$dirty" != "" ]; then
# echo "ERROR: Git repo isn't clean - I'd recommend you make a separate recursive clone of CmdStan for this."
# exit
#fi
# If we're not checking develop for cmdstan, use custom stanc3 binary url
write_makelocal "$4"
git status
cd ..
}
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
usage
exit
fi
set -e -x
# Checkout base cmdstan
clean_checkout "$2" "false" "false" ""
./runPerformanceTests.py --overwrite-golds $1
for i in performance.*; do
mv $i "${2}_${i}"
done
echo "Stanc3 binary url $6"
# Checkout cmdstan PR, will use custom stanc3 binary url
clean_checkout "$3" "$4" "$5" "$6"
./runPerformanceTests.py --check-golds $1 && ./comparePerformance.py "${2}_performance.csv" performance.csv markdown