# 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 {
# Script body
-SPLASH2="$(dirname $0)/../splash2"
+DRD_SCRIPTS_DIR="$(dirname $0)"
+if [ "${DRD_SCRIPTS_DIR}" = "." ]; then
+ DRD_SCRIPTS_DIR="$PWD"
+fi
+
+SPLASH2="${DRD_SCRIPTS_DIR}/../splash2"
if [ ! -e "${SPLASH2}" ]; then
echo "Error: splash2 directory not found (${SPLASH2})."
exit 1
fi
if [ "$VG" = "" ]; then
- VG="$(dirname $0)/../../vg-in-place"
+ VG="${DRD_SCRIPTS_DIR}/../../vg-in-place"
fi
if [ ! -e "$VG" ]; then
exit 1
fi
-# Results: (-p1) (-p2) (-p3) (-p4) ITC (-p4)
-# lu, contiguous blocks: 40 48 53 55 420
-# lu, non-contiguous blocks: 37 47 55 58 420
-# radiosity: 99 99 99 99 490
+# Results: (-p1) (-p2) (-p3) (-p4) ITC (-p4) ITC (-p4)
+# original w/ filter
+# .........................................................................
+# Cholesky 46 59 75 92 239 82
+# FFT 15 90 41
+# LU, contiguous blocks 40 48 53 55 428 128
+# LU, non-contiguous blocks 37 47 55 58 428 128
+# Ocean 90 28
+# Radiosity 99 99 99 99 485 163
+# Radix 222 56
+# Raytrace 172 53
+# Water-n2 189 39
+# Water-sp 183 34
+
+cache_size=$(get_cache_size)
+log2_cache_size=$(log2 ${cache_size})
+
+# Cholesky
+if false; then
+(
+ cd ${SPLASH2}/codes/kernels/cholesky
+ if [ ! -e inputs/tk29.O ]; then
+ gzip -cd < inputs/tk29.O.Z > inputs/tk29.O
+ fi
+ run_test ./CHOLESKY -C${cache_size} -n1024 inputs/tk29.O
+)
+fi
+
+# FFT
+run_test ${SPLASH2}/codes/kernels/fft/FFT -l${log2_cache_size} -m$((2**28))
+exit 1
-# lu, contiguous blocks.
+# LU, contiguous blocks.
run_test ${SPLASH2}/codes/kernels/lu/contiguous_blocks/LU -n1024
-# lu, non-contiguous blocks.
+# LU, non-contiguous blocks.
run_test ${SPLASH2}/codes/kernels/lu/non_contiguous_blocks/LU -n1024
-# radiosity.
+# Radiosity.
run_test ${SPLASH2}/codes/apps/radiosity/RADIOSITY -batch -room