aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKugan Vivekanandarajah <kuganv@linaro.org>2014-12-02 21:23:06 +1100
committerKugan Vivekanandarajah <kuganv@linaro.org>2014-12-02 21:23:06 +1100
commitefd0fed9d8d43ffb82a1cc01fb0abd09284d6e56 (patch)
treea0c062dfe02f693202de88ef674c8f068a471d11
parent3ed6a229cd1ff3be72466ad8068ae1f55be7e0e8 (diff)
version used to run benchmarks on Juno. Note that this also reverts some of the latest commits to trunk which can be merged. For now, keeping the exact version used.juno-lava
-rwxr-xr-xspec2xxx-check32
-rwxr-xr-xspec2xxx-install47
-rwxr-xr-xspec2xxx-prepare137
-rwxr-xr-xspec2xxx-run57
4 files changed, 237 insertions, 36 deletions
diff --git a/spec2xxx-check b/spec2xxx-check
index e554cdb..8af308e 100755
--- a/spec2xxx-check
+++ b/spec2xxx-check
@@ -5,6 +5,30 @@ set -x
stages="$@"
+usage()
+{
+ echo "Usage: $0 [-h host] [-t target] [-s spec_dir]" 1>&2;
+ exit 1;
+}
+
+while getopts “h:t:s:” OPTION
+do
+ case $OPTION in
+ h)
+ HOST=$OPTARG
+ ;;
+ t)
+ TARGET=$OPTARG
+ ;;
+ s)
+ SPEC=$OPTARG
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+
if [ "x$stages" = "x" ]; then
stages="install prepare build run result"
fi
@@ -41,6 +65,12 @@ else
fi
ssh $target true
+if [ "$(ssh $target echo \$SHELL)" != "/bin/bash" ]; then
+ echo "$target is using non-bash shell"
+ ssh $target $sudo usermod -s /bin/bash \$USER
+fi
+
+fusermount -u $spec || true
mkdir -p $spec
spec=$(cd $spec; pwd)
@@ -72,6 +102,6 @@ case "$stages" in
d2=$(date +%s)
if [ "$(echo "($d2 - $d1) > 10 || ($d1 - $d2) > 10" | bc)" != "0" ]; then
echo "Time difference between $host and $target is more than 10 seconds"
- ssh $target $sudo date -s "$(date)"
+ ssh $target $sudo date -s "@$(date +%s)"
fi
esac
diff --git a/spec2xxx-install b/spec2xxx-install
index 2026e6e..bde9760 100755
--- a/spec2xxx-install
+++ b/spec2xxx-install
@@ -5,11 +5,32 @@ set -x
${0%%-install}-check install
+usage()
+{
+ echo "Usage: $0 [-p package_tar] [-v version]" 1>&2;
+ exit 1;
+}
+
+while getopts “p:v:” OPTION
+do
+ case $OPTION in
+ p)
+ TAR=$OPTARG
+ ;;
+ v)
+ VERSION=$OPTARG
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+
host=$HOST
target=$TARGET
spec=$SPEC
-tar=$1
-specver=$2
+tar=$TAR
+specver=$VERSION
if [ "x$specver" = "x" ]; then
case "$tar" in
@@ -49,7 +70,7 @@ fi
cat $tar | ssh $target "cd $spec && tar --strip-components=1 -xJ && chmod -R +w ./"
-cpu="$(ssh $target uname -p)"
+cpu="$(ssh $target uname -m)"
toolstar=""
case "$specver" in
"cpu2000v1.3")
@@ -60,9 +81,13 @@ case "$specver" in
arch=linux-armv7l
toolstar=linux-armv7l-122.tar.bz2
;;
+ "aarch64")
+ arch=linux-aarch64
+ toolstar=linux-aarch64-122.tar.bz2
+ ;;
*)
- arch="linux-$cpu"
toolstar="build"
+ ;;
esac
;;
"cpu2006v1.2")
@@ -78,8 +103,8 @@ case "$specver" in
toolstar=linux-apm-arm64-118.tar
;;
*)
- arch="linux-$cpu"
toolstar="build"
+ ;;
esac
;;
esac
@@ -87,13 +112,19 @@ esac
case "$toolstar" in
"") ;;
"build")
+ arch="linux-$cpu"
+
# Make sure bash is used for building perl
echo "/bin/bash \$@" > $spec/bin/sh
chmod +x $spec/bin/sh
- # Patch up perl sources
case "$specver" in
"cpu2000v1.3")
+ # Patch up specmd5sum
+ sed -i -e "/^int/d" -e "/^getline/d" -e "/^getdelim/d" \
+ $spec/tools/src/specmd5sum/lib/getline.h
+
+ # Patch up perl sources
sed -i -e "s#command line#command\.line#" \
$spec/tools/src/perl-5.8.7/makedepend.SH
sed -i -e "/asm\/page.h/d" \
@@ -103,8 +134,10 @@ case "$toolstar" in
# Find where libm.so and libdl.so are
libpth=$(ssh $target find /usr -name libm.so | sed -e "s#/libm.so##")
+ # config.guess can be too old to know about new architecture.
+ configflags="--build=$cpu-unknown-linux-gnu"
- ssh $target "cd $spec && PATH=$spec/bin:\$PATH PERLFLAGS='-A libs=-lm -A libs=-ldl -A libs=-lcrypt -Dlibpth=$libpth' $spec/tools/src/buildtools && . shrc && packagetools $arch"
+ ssh $target "cd $spec && PATH=$spec/bin:\$PATH PERLFLAGS='-A libs=-lm -A libs=-ldl -A libs=-lcrypt -Dlibpth=$libpth' CONFIGFLAGS=\"$configflags\" $spec/tools/src/buildtools && . shrc && packagetools $arch"
# Clean up
rm $spec/bin/sh
diff --git a/spec2xxx-prepare b/spec2xxx-prepare
index 1204682..af0ada5 100755
--- a/spec2xxx-prepare
+++ b/spec2xxx-prepare
@@ -5,12 +5,38 @@ set -x
${0%%-prepare}-check prepare
+usage()
+{
+ echo "Usage: $0 [-c cc_prefix] [-o optimize] [-i cpuinfo]" 1>&2;
+ exit 1;
+}
+
+while getopts “c:o:i:” OPTION
+do
+ case $OPTION in
+ c)
+ CC_PREFIX=$OPTARG
+ ;;
+ o)
+ OPTIMIZE=$OPTARG
+ ;;
+ i)
+ CPUINFO=$OPTARG
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+
+
host=$HOST
target=$TARGET
spec=$SPEC
config=$CONFIG
-config_tmpl=$1
-cc_prefix=$2
+cc_prefix=$CC_PREFIX
+optimize="$OPTIMIZE"
+cpuinfo=$CPUINFOa
if [ "$host" != "$target" ]; then
local=false
@@ -22,22 +48,109 @@ spec=$(cd $spec; pwd)
$local || sshfs $target:$spec $spec
+if [ "$(dirname $cc_prefix)" != "" ]; then
+ lib_path=$(dirname $cc_prefix)/../aarch64-linux-gnu/
+ cp -r $lib_path/lib $spec/lib
+ cp -r $lib_path/libc $spec/libc
+fi
+
for cc in gcc g++ gfortran; do
+if [ "$lib_path" = "" ]; then
cat > $spec/bin/ssh-$config-$cc <<EOF
-#!/bin/sh
-
-cmd=\$(echo "\$@" | sed -e 's#"#\\"#g' -e "s#'#\\'#g")
-ssh -S $spec/ssh-%r@%h:%p $host "cd \$(pwd); $cc_prefix$cc \$cmd"
+ #!/bin/sh
+ cmd=\$(echo "\$@" | sed -e 's#"#\\"#g' -e "s#'#\\'#g")
+ ssh -S $spec/ssh-%r@%h:%p $host "cd \$(pwd); $cc_prefix$cc \$cmd"
+EOF
+else
+ cat > $spec/bin/ssh-$config-$cc <<EOF
+ #!/bin/sh
+ cmd=\$(echo "\$@" | sed -e 's#"#\\"#g' -e "s#'#\\'#g")
+ ssh -S $spec/ssh-%r@%h:%p $host "cd \$(pwd); $cc_prefix$cc -Wl,--dynamic-linker=$spec/libc/lib/ld-linux-aarch64.so.1 -Wl,-rpath=$spec/libc/lib/aarch64-linux-gnu:$spec/lib \$cmd"
EOF
+fi
chmod +x $spec/bin/ssh-$config-$cc
done
-cat $config_tmpl | sed \
- -e "s#@CC@#ssh-$config-gcc#" \
- -e "s#@CXX@#ssh-$config-g++#" \
- -e "s#@FORTRAN@#ssh-$config-gfortran#" \
- -e "s#@SUBMIT@#taskset 0x2 \$command#" \
- -e "s#@PARALLELIZE@#$(getconf _NPROCESSORS_ONLN)#" \
+if [ "$cpuinfo" = "" ]; then
+ cpuinfo=$spec/cpuinfo
+ ssh $target "cat /proc/cpuinfo > $cpuinfo"
+fi
+
+hw_model="$(cat $cpuinfo | grep Hardware | head -n 1 | sed -e 's/.*: //')"
+hw_cpu="$(cat $cpuinfo | grep "model name\|Processor" | head -n 1 | sed -e 's/.*: //')"
+hw_fpu="$(cat $cpuinfo | grep Features | head -n 1 | sed -e 's/.*: //')"
+
+sw_os="$(ssh $target uname -r | head -n 1)"
+
+sw_compiler="$(${cc_prefix}gcc -v 2>&1 | tail -n 1)"
+sw_compiler="$sw_compiler $(${cc_prefix}gcc -v 2>&1 | grep 'Configured with' | head -n 1)"
+
+case "$hw_cpu" in
+ *"v7l"*) mcpu="-mcpu=cortex-a15" ;;
+ *"aarch64"*)
+ case "$optimize" in
+ *"cortex-a53"*) mcpu="-mcpu=cortex-a53" ;;
+ *) mcpu="-mcpu=cortex-a57" ;;
+ esac
+ ;;
+ *) mcpu="" ;;
+esac
+
+case "$hw_fpu" in
+ *"neon"*"vfpv4"*) mfpu="-mfpu=neon-vfpv4" ;;
+ *) mfpu="" ;;
+esac
+
+arch="$(ssh $target uname -m)"
+case "$arch" in
+ "aarch64"|"x86_64")
+ spec_cpu2000_lp64="-DSPEC_CPU2000_LP64"
+ spec_cpu_lp64="-DSPEC_CPU_LP64"
+ ;;
+ "armv7l"|"ia32"|*)
+ spec_cpu2000_lp64=""
+ spec_cpu_lp64=""
+ ;;
+esac
+
+case "$arch" in
+ "aarch64")
+ case "$optimize" in
+ *"cortex-a53"*) taskset_cpu="1" ;;
+ *) taskset_cpu="4" ;;
+ esac
+ ;;
+ *) taskset_cpu="1" ;;
+esac
+
+cfg_tmpl="$(dirname $0)/cpu2xxx.cfg"
+if grep CPU2000 $spec/shrc; then
+ cfg_tmpl="$cfg_tmpl $(dirname $0)/cpu2000.cfg"
+fi
+if grep CPU2006 $spec/shrc; then
+ cfg_tmpl="$cfg_tmpl $(dirname $0)/cpu2006.cfg"
+fi
+
+cat $cfg_tmpl | sed \
+ -e "s#@HW_MODEL@#$hw_model#g" \
+ -e "s#@HW_CPU@#$hw_cpu#g" \
+ -e "s#@HW_FPU@#$hw_fpu#g" \
+ -e "s#@SW_OS@#$sw_os#g" \
+ -e "s#@SW_COMPILER@#$sw_compiler#g" \
+ -e "s#@PARALLELIZE@#$(getconf _NPROCESSORS_ONLN)#g" \
+ -e "s#@SUBMIT@#taskset -c $taskset_cpu \$command#g" \
+ -e "s#@ITERATIONS@#5#g" \
+ -e "s#@ITERATIONS_2@#7#g" \
+ -e "s#@ITERATIONS_4@#9#g" \
+ -e "s#@CC@#ssh-$config-gcc#g" \
+ -e "s#@CXX@#ssh-$config-g++#g" \
+ -e "s#@FORTRAN@#ssh-$config-gfortran#g" \
+ -e "s#@OPTIMIZE@#$optimize_#g" \
+ -e "s#@MCPU@#$mcpu#g" \
+ -e "s#@MFPU@#$mfpu#g" \
+ -e "s#@PROFILEDIR@#$spec#g" \
+ -e "s#@DSPEC_CPU2000_LP64@#$spec_cpu2000_lp64#g" \
+ -e "s#@DSPEC_CPU_LP64@#$spec_cpu_lp64#g" \
> $spec/config/$config.tmp
if ! diff -u $spec/config/$config.tmp $spec/config/$config.cfg | head -n 8 | grep __MD5__; then
diff --git a/spec2xxx-run b/spec2xxx-run
index 89ada3a..cf0922c 100755
--- a/spec2xxx-run
+++ b/spec2xxx-run
@@ -10,6 +10,11 @@ spec=$SPEC
config=$CONFIG
opts="$@"
+doservices=true
+dofreqscaling=true
+dotaskbind=true
+donetwork=false
+
spec=$(cd $spec; pwd)
if ssh $target echo \$USER | grep root; then
@@ -18,8 +23,8 @@ else
sudo=sudo
fi
-if ssh $target $sudo initctl list >/dev/null \
- || ssh $target croutonversion >/dev/null 2>&1; then
+if $doservices && \
+ (ssh $target $sudo initctl list >/dev/null || ssh $target croutonversion >/dev/null 2>&1); then
# Stop all but few services. Note all stopped services in stopped-services
# file to restart them after benchmarks. Network and SSH server are
# handled separately.
@@ -47,28 +52,34 @@ if ssh $target $sudo initctl list >/dev/null \
fi
# Disable frequency scaling
-old_governor=$(ssh $target cpufreq-info -p | cut -f 3 -d " ")
-if [ "x$old_governor" = "x" ] \
- || ! ssh $target $sudo cpufreq-set -g performance; then
- old_governor=""
- echo FREQUENCY SCALING NOT SUPPORTED
+old_governor=""
+if $dofreqscaling; then
+ old_governor=$(ssh $target cpufreq-info -p | cut -f 3 -d " ")
+ if [ "x$old_governor" = "x" ] || ! ssh $target $sudo cpufreq-set -g performance; then
+ old_governor=""
+ echo FREQUENCY SCALING NOT SUPPORTED
+ fi
fi
# Bind all existing processes to CPU #0. We then run benchmarks on CPU #1.
-if ssh $target $sudo taskset -a -p 0x1 1; then
+if $dotaskbind && \
+ (ssh $target $sudo taskset -a -p 0x1 1); then
ssh $target "for p in \$(ps ax --format='%p' | tail -n +2); do $sudo taskset -a -p 0x1 \$p 2>&1; done | wc"
else
echo CPU BIND NOT SUPPORTED
fi
# Figure out how to stop/start network.
-if ssh $target croutonversion >/dev/null 2>&1; then
+if $donetwork && \
+ (ssh $target croutonversion >/dev/null 2>&1); then
network_before="$sudo chroot /proc/1/root /bin/bash -c 'stop shill && stop wpasupplicant' && sleep 2"
network_after="$sudo chroot /proc/1/root /bin/bash -c 'start wpasupplicant && start shill' && $sudo /sbin/iptables -P INPUT ACCEPT"
-elif ssh $target "$sudo stop network-interface INTERFACE=lo && $sudo start network-interface INTERFACE=lo"; then
+elif $donetwork && \
+ (ssh $target "$sudo stop network-interface INTERFACE=lo && $sudo start network-interface INTERFACE=lo"); then
network_before="$sudo stop network-interface INTERFACE=eth0 && sleep 2"
network_after="$sudo start network-interface INTERFACE=eth0"
-elif ssh $target "$sudo ifdown lo && $sudo ifup lo"; then
+elif $donetwork && \
+ (ssh $target "$sudo ifdown lo && $sudo ifup lo"); then
network_before="$sudo ifdown eth0 && sleep 2"
network_after="$sudo ifup eth0"
else
@@ -76,16 +87,28 @@ else
network_after="echo NETWORK CONTROL NOT SUPPORTED"
fi
+if ssh $target croutonversion >/dev/null 2>&1 \
+ || ssh $target "$sudo initctl status ssh" | grep process; then
+ ssh_before="$sudo stop ssh"
+ ssh_after="$sudo start ssh"
+elif false; then
+ ssh_before="$sudo /etc/init.d/ssh stop"
+ ssh_after="$sudo /etc/init.d/ssh start"
+else
+ ssh_before="$sudo /etc/init.d/sshd stop"
+ ssh_after="$sudo /etc/init.d/sshd start"
+fi
+
cmd="true"
-cmd="$cmd && $sudo stop ssh"
+cmd="$cmd && $ssh_before"
cmd="$cmd && $network_before"
cmd="$cmd && ps auxf"
cmd="$cmd && (cd $spec && . shrc && runspec -c $config $opts) || true"
cmd="$cmd && $network_after"
-cmd="$cmd && $sudo start ssh"
+cmd="$cmd && $ssh_after"
# Send /the/ command.
-ssh -fn $target "nohup /bin/bash -c \"$cmd\" >$spec/runspec.$(date +%Y%m%dT%H%M%S) 2>&1 &"
+ssh -fn $target "nohup /bin/bash -c \"$cmd\" 2>&1 | tee /dev/console > $spec/runspec.$(date +%Y%m%dT%H%M%S) 2>&1 &"
# Sleep till SSH server on the board is back online.
date
@@ -96,7 +119,8 @@ set -x
# Undo benchmark environment preparations.
-if ssh $target $sudo taskset -a -p 0xFFFFFFFF 1; then
+if $dotaskset && \
+ (ssh $target $sudo taskset -a -p 0xFFFFFFFF 1); then
ssh $target "for p in \$(ps ax --format='%p' | tail -n +2); do $sudo taskset -a -p 0xFFFFFFFF \$p 2>&1; done | wc"
else
echo CPU BIND NOT SUPPORTED
@@ -106,7 +130,8 @@ if [ "x$old_governor" != "x" ]; then
ssh $target $sudo cpufreq-set -g $old_governor
fi
-if ssh $target $sudo initctl list >/dev/null || ssh $target croutonversion >/dev/null 2>&1; then
+if $doservices && \
+ (ssh $target $sudo initctl list >/dev/null || ssh $target croutonversion >/dev/null 2>&1); then
sudo_old=$sudo
if ssh $target croutonversion >/dev/null 2>&1; then
sudo="$sudo chroot /proc/1/root sudo"