-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_all.sh
executable file
·198 lines (167 loc) · 6.17 KB
/
run_all.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash
# Authors: Aaron Graham ([email protected], [email protected]) and
# Jean-Philippe Legault ([email protected], [email protected])
# for the Centre for Advanced Studies - Atlantic (CAS-Atlantic) at the
# Univerity of New Brunswick in Fredericton, New Brunswick, Canada
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): Init:"
OPT_JDKS_PATTERN="/opt/jdk*/*/bin/java"
OPT_JDKS=( $OPT_JDKS_PATTERN )
# Grab First Found JDK in /opt/jdk*/ Directory:
OPT_JDK="${OPT_JDKS[0]}"
# Set JAVA_ROOT from Command Line Argument:
if [[ "" != $1 ]] && [[ -a "$1/bin/java" ]];
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): INFO: Setting JDK from Command-Line Argument (\$1: '$1').\n"
JAVA_ROOT="$1"
# Make Sure an /opt/jdk*/ Directory Exists and an /opt/jdk*/*/bin/java Executable Exists:
elif [[ -d "`echo $OPT_JDK | sed -e 's#/bin/java$##'`" ]] && [[ -a "$OPT_JDK" ]];
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): WARNING: Setting JDK from Fisrt Found JDK in /opt/jdk*/ Directory (echo \$OPT_JDK | sed -e 's#/bin/java\$##': '`echo $OPT_JDK | sed -e 's#/bin/java$##'`').\n"
JAVA_ROOT=`echo $OPT_JDK | sed -e 's#/bin/java$##'`
# Get JDK from JDK_HOME
elif [[ "" != "$JDK_HOME" ]] && [[ -a "$JDK_HOME/bin/java" ]];
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): WARNING: Setting JDK from JDK_HOME (JDK_HOME: '$JDK_HOME').\n"
JAVA_ROOT="$JDK_HOME"
# Get JDK from JAVA_HOME
elif [[ "" != "$JAVA_HOME" ]] && [[ -a "$JAVA_HOME/bin/java" ]];
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): WARNING: Setting JDK from JAVA_HOME (JAVA_HOME: '$JAVA_HOME').\n"
JAVA_ROOT="$JAVA_HOME"
# Get JDK from PATH
elif [[ "" != "$PATH" ]] && [[ "" != "`which java`" ]];
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): WARNING: Setting JDK from PATH (which java | sed -e 's#/bin/java\$##': '`which java | sed -e 's#/bin/java$##'`').\n"
JAVA_ROOT=`which java | sed -e 's#/bin/java$##'`
else
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): ERROR: No Passed in JDK and Couldn't find a valid JDK in JDK_HOME, JAVA_HOME or PATH to Execute!\n\nExiting...\n"
exit -1
fi
echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): JAVA_ROOT: '$JAVA_ROOT'"
# Check if The '/usr/bin/time' Executable Exists:
if [[ ! -a /usr/bin/time ]] || ! hash time 2>/dev/null;
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): ERROR: The '/usr/bin/time' Executable Doesn't Exist!\n\nExiting...\n"
exit -1
fi
# Check if The 'curl' Executable Exists:
if ! hash curl 2>/dev/null;
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): ERROR: The 'curl' Executable Doesn't Exist!\n\nExiting...\n"
exit -1
fi
# Check if The 'javac' Executable Exists:
if ! hash javac 2>/dev/null;
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): ERROR: The 'javac' Executable Doesn't Exist!\n\nExiting...\n"
exit -1
fi
# Check if The 'java' Executable Exists:
if ! hash java 2>/dev/null;
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): ERROR: The 'java' Executable Doesn't Exist!\n\nExiting...\n"
exit -1
fi
# Check if The 'cpupower' Executable Exists:
if ! hash cpupower 2>/dev/null;
then
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): ERROR: The 'cpupower' Executable Doesn't Exist!\n\nExiting...\n"
exit -1
fi
case $(uname -m) in
aarch64)
case $(uname -n) in
Khadas)
# vim3 has 6 cpus, we need to disable 0 and 1 since they are A53 cores
echo 0 | sudo tee /sys/devices/system/cpu/cpu0/online
echo 0 | sudo tee /sys/devices/system/cpu/cpu1/online
# vim3 is at 1.30
sudo ./lock_frequency.sh "1.30"
CPU_TYPE="A73"
;;
casa-pi4b-1)
# Raspberry Pi 4 B is at 1.30
sudo ./lock_frequency.sh "1.30"
CPU_TYPE="A72"
;;
*)
# rock64 is at 1.30
sudo ./lock_frequency.sh "1.30"
CPU_TYPE="A53"
;;
esac
;;
x86_64)
case $(uname -n) in
beelink1)
# atom board closest frequency is 1.28
sudo ./lock_frequency.sh "1.28"
CPU_TYPE="amd64"
;;
*)
CPU_TYPE="amd64"
;;
esac
;;
*)
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): ERROR: Architecture '$(uname -m)' Not Supported!\n\nExiting...\n"
exit -1
;;
esac
ITERATE="1"
BENCHMARK_DIR=(
"Benchmarks/SPECjvm2008"
"Benchmarks/DaCapo"
"Benchmarks/ScimarkC"
"Benchmarks/ScimarkJava"
"Benchmarks/RenaissanceSuite"
)
JAVA_HOME="${JAVA_ROOT}"
# More OpenJ9 Command-Line Options:
# -verbose:sizes
# -Xjit:disableCompactLocals
# -Xint
# -Xjit:exclude={java/io/Object*.*}
# -Xss2M
# -Xjit:disableEscapeAnalysis
# -Xdump:java+system:events=throw+systhrow,filter=java/lang/StackOverflowError
JAVA_OPTS=" -Xms2G -Xmx2G "
VM="$(basename "${JAVA_ROOT}")"
echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): CPU_TYPE: '$CPU_TYPE'"
echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): BENCHMARK_DIR[@]: '${BENCHMARK_DIR[@]}'"
echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): JAVA_HOME: '$JAVA_HOME'"
echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): JAVA_OPTS: '$JAVA_OPTS'"
echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): VM: '$VM'\n"
# Is a built-from-source JVM:
if [[ "jdk" == "${VM}" ]];
then
VM="${JAVA_ROOT}"
echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): INFO: Setting 'VM' as built-from-source JVM (VM: 'jdk' -> '$VM')\n"
fi
for BENCHMARK in ${BENCHMARK_DIR[@]}
do
pushd "${BENCHMARK}" || exit 1
case "${VM}" in
*openj9*)
VM="openj9"
;;
*j9*)
VM="openj9"
;;
*hotspot*)
VM="hotspot"
;;
*)
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): ERROR: Unknown JVM VM: '${VM}' in JAVA_ROOT: '${JAVA_ROOT}'! Expecting an OpenJ9 or Hotspot JVM.\n\nExiting...\n"
exit -1
;;
esac
# echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): VM: '$VM'"
# echo -e "${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): JAVA_OPTS: '$JAVA_OPTS'\n"
for (( i=1; i <= ITERATE; i++ ))
do
make CPU_TYPE="${CPU_TYPE}" VM="${VM}" JAVA_HOME="${JAVA_HOME}" JAVA_OPTS="${JAVA_OPTS}"
done
popd || exit 1
done
echo -e "\n${0##*/}@${HOSTNAME}:$( date "+%Y.%m.%d.%H%M.%S" ): End (RC: '$?').\n\n"