Files
ftmemsim-valgrind/exp-drd/scripts/run-splash2
Bart Van Assche dbfc525689 The run-splash2 script now works regardless from which directory it is started in.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8194
2008-06-06 10:17:26 +00:00

175 lines
4.3 KiB
Bash
Executable File

#!/bin/bash
########################
# Function definitions #
########################
function log2 {
local i
for ((i=0;i<64;i++))
do
if [ $((2**i)) = $1 ]; then
echo $i
return 0
fi
done
echo ""
return 1
}
function get_cache_size {
local s
s=$(</sys/devices/system/cpu/cpu0/cache/index2/size)
if [ "${s%M}" != "$s" ]; then
echo $((${s%M}*1024*1024))
elif [ "${s%K}" != "$s" ]; then
echo $((${s%K}*1024))
else
echo $s
fi
}
# Read a stream of numbers from stdin (one per line), and print the average
# and standard deviation.
function avgstddev {
awk '{n++;sum+=$1;sumsq+=$1*$1}END{d=sumsq/n-sum*sum/n/n;print sum/n,(d>0?sqrt(d):0)}'
}
function run_test {
local tmp avg1=1 stddev1=1 avg2=1 stddev2=1
tmp="/tmp/test-timing.$$"
rm -f "${tmp}"
echo "$@"
for ((i=0;i<3;i++))
do
cat "${test_input:-/dev/null}" | \
/usr/bin/time --format="%e" "$@" 2>&1 | \
tail -n 1
done | avgstddev > "$tmp"
read avg1 stddev1 < "$tmp"
echo "Average time: ${avg1} +/- ${stddev1} seconds"
for p in 1 2 4
do
echo "$VG --tool=exp-drd $@ -p$p"
for ((i=0;i<3;i++))
do
cat "${test_input:-/dev/null}" | \
/usr/bin/time --format="%e" $VG --tool=exp-drd "$@" -p$p 2>&1 | \
tail -n 1
done | avgstddev > "$tmp"
read avg2 stddev2 < "$tmp"
echo "Average time: ${avg2} +/- ${stddev2} seconds"
awk "END{print "'"'"Ratio ="'"'", ${avg2}/${avg1}, "'"'"+/-"'"'", ${avg2}/${avg1}*(${stddev1}/${avg1}+${stddev2}/${avg2})}" </dev/null
done
echo ''
rm -f "$tmp"
}
# Script body
DRD_SCRIPTS_DIR="$(dirname $0)"
if [ "${DRD_SCRIPTS_DIR:0:1}" != "/" ]; then
DRD_SCRIPTS_DIR="$PWD/$DRD_SCRIPTS_DIR"
fi
SPLASH2="${DRD_SCRIPTS_DIR}/../splash2"
if [ ! -e "${SPLASH2}" ]; then
echo "Error: splash2 directory not found (${SPLASH2})."
exit 1
fi
if [ "$VG" = "" ]; then
VG="${DRD_SCRIPTS_DIR}/../../vg-in-place"
fi
if [ ! -e "$VG" ]; then
echo "Could not find $VG."
exit 1
fi
# Results: (-p1) (-p2) (-p3) (-p4) ITC (-p4) ITC (-p4)
# original w/ filter
# .........................................................................
# Cholesky 39 49 ? 81 239 82
# FFT 15 16 N/A 43 90 41
# LU, contiguous blocks 38 39 ? 43 428 128
# LU, non-contiguous blocks 32 34 ? 41 428 128
# Ocean, contiguous partitions 19 23 N/A 29 90 28
# Ocean, non-continguous partns 18 21 N/A 31 90 28
# Radiosity 92 92 ? 92 485 163
# Radix 11 14 ? 16 222 56
# Raytrace 70 70 ? 70 172 53
# Water-n2 50 50 ? 50 189 39
# Water-sp 49 48 ? 49 183 34
#
# Hardware: dual-core Intel Xeon 5130, 1.995 MHz, 4 MB L2 cache, 4 GB RAM.
# Software: Ubuntu 7.10 server, 64-bit (includes gcc 4.1.3).
cache_size=$(get_cache_size)
log2_cache_size=$(log2 ${cache_size})
# Cholesky
(
cd ${SPLASH2}/codes/kernels/cholesky/inputs
for f in *Z
do
gzip -cd <$f >${f%.Z}
done
run_test ../CHOLESKY -C${cache_size} -n1024 tk29.O
)
# FFT
run_test ${SPLASH2}/codes/kernels/fft/FFT -t -l${log2_cache_size} -m20
# LU, contiguous blocks.
run_test ${SPLASH2}/codes/kernels/lu/contiguous_blocks/LU -n1024
# LU, non-contiguous blocks.
run_test ${SPLASH2}/codes/kernels/lu/non_contiguous_blocks/LU -n1024
# Ocean
run_test ${SPLASH2}/codes/apps/ocean/contiguous_partitions/OCEAN -n2050
run_test ${SPLASH2}/codes/apps/ocean/non_contiguous_partitions/OCEAN -n258
# Radiosity.
run_test ${SPLASH2}/codes/apps/radiosity/RADIOSITY -batch -room
# Radix
run_test ${SPLASH2}/codes/kernels/radix/RADIX -n$((2**24))
# Raytrace
(
cd ${SPLASH2}/codes/apps/raytrace/inputs
rm -f *.env *.geo *.rl
for f in *Z
do
gzip -cd <$f >${f%.Z}
done
run_test ../RAYTRACE balls4.env
)
# Water-n2
(
cd ${SPLASH2}/codes/apps/water-nsquared
test_input=input run_test ./WATER-NSQUARED
)
# Water-sp
(
cd ${SPLASH2}/codes/apps/water-spatial
test_input=input run_test ./WATER-SPATIAL
)
# Local variables:
# compile-command: "./run-splash2"
# End: