bart | 8785c12 | 2008-05-29 08:34:27 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | ######################## |
| 4 | # Function definitions # |
| 5 | ######################## |
| 6 | |
| 7 | # Read a stream of numbers from stdin (one per line), and print the average |
| 8 | # and standard deviation. |
| 9 | function avgstddev { |
bart | f06b427 | 2008-05-30 09:52:13 +0000 | [diff] [blame] | 10 | awk '{n++;sum+=$1;sumsq+=$1*$1}END{d=sumsq/n-sum*sum/n/n;print sum/n,(d>0?sqrt(d):0)}' |
bart | 8785c12 | 2008-05-29 08:34:27 +0000 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | function run_test { |
| 14 | local tmp avg1=1 stddev1=1 avg2=1 stddev2=1 |
| 15 | |
| 16 | tmp="/tmp/test-timing.$$" |
| 17 | echo "$@" |
| 18 | for ((i=0;i<3;i++)) |
| 19 | do |
| 20 | /usr/bin/time --format="%e" "$@" 2>&1 | tail -n 1 |
| 21 | done | avgstddev > "$tmp" |
| 22 | read avg1 stddev1 < "$tmp" |
| 23 | echo "Average time: ${avg1} +/- ${stddev1} seconds" |
| 24 | |
| 25 | echo "$VG --tool=exp-drd $@" |
| 26 | for ((i=0;i<3;i++)) |
| 27 | do |
| 28 | /usr/bin/time --format="%e" $VG --tool=exp-drd "$@" 2>&1 | tail -n 1 |
| 29 | done | avgstddev > "$tmp" |
| 30 | read avg2 stddev2 < "$tmp" |
| 31 | echo "Average time: ${avg2} +/- ${stddev2} seconds" |
| 32 | |
| 33 | awk "END{print "'"'"Ratio ="'"'", ${avg2}/${avg1}, "'"'"+/-"'"'", ${avg2}/${avg1}*(${stddev1}/${avg1}+${stddev2}/${avg2})}" </dev/null |
| 34 | |
| 35 | echo '' |
| 36 | |
| 37 | rm -f "$tmp" |
| 38 | } |
| 39 | |
| 40 | |
| 41 | # Script body |
| 42 | |
| 43 | if [ ! -e splash2 ]; then |
| 44 | echo "Error: splash2 directory not found." |
| 45 | exit 1 |
| 46 | fi |
| 47 | |
| 48 | if [ "$VG" = "" ]; then |
| 49 | VG=../vg-in-place |
| 50 | fi |
| 51 | |
| 52 | if [ ! -e "$VG" ]; then |
| 53 | echo "Could not find $VG." |
| 54 | exit 1 |
| 55 | fi |
| 56 | |
bart | f06b427 | 2008-05-30 09:52:13 +0000 | [diff] [blame] | 57 | # Results (-p1): exp-drd (-p1) (-p2) (-p4) ITC (-p4) |
| 58 | # lu, contiguous blocks: 39 43 46 420 |
| 59 | # lu, non-contiguous blocks: 34 41 48 420 |
| 60 | # radiosity: 99 490 |
bart | 8785c12 | 2008-05-29 08:34:27 +0000 | [diff] [blame] | 61 | |
bart | f06b427 | 2008-05-30 09:52:13 +0000 | [diff] [blame] | 62 | # lu, contiguous blocks. |
bart | 8785c12 | 2008-05-29 08:34:27 +0000 | [diff] [blame] | 63 | run_test splash2/codes/kernels/lu/contiguous_blocks/LU -p1 -n1024 |
| 64 | run_test splash2/codes/kernels/lu/contiguous_blocks/LU -p2 -n1024 |
bart | f06b427 | 2008-05-30 09:52:13 +0000 | [diff] [blame] | 65 | run_test splash2/codes/kernels/lu/contiguous_blocks/LU -p4 -n1024 |
bart | 8785c12 | 2008-05-29 08:34:27 +0000 | [diff] [blame] | 66 | |
bart | f06b427 | 2008-05-30 09:52:13 +0000 | [diff] [blame] | 67 | # lu, non-contiguous blocks. |
bart | 8785c12 | 2008-05-29 08:34:27 +0000 | [diff] [blame] | 68 | run_test splash2/codes/kernels/lu/non_contiguous_blocks/LU -p1 -n1024 |
| 69 | run_test splash2/codes/kernels/lu/non_contiguous_blocks/LU -p2 -n1024 |
bart | f06b427 | 2008-05-30 09:52:13 +0000 | [diff] [blame] | 70 | run_test splash2/codes/kernels/lu/non_contiguous_blocks/LU -p4 -n1024 |
bart | 8785c12 | 2008-05-29 08:34:27 +0000 | [diff] [blame] | 71 | |
bart | f06b427 | 2008-05-30 09:52:13 +0000 | [diff] [blame] | 72 | # radiosity. |
bart | 8785c12 | 2008-05-29 08:34:27 +0000 | [diff] [blame] | 73 | run_test splash2/codes/apps/radiosity/RADIOSITY -p1 -batch -room |
| 74 | run_test splash2/codes/apps/radiosity/RADIOSITY -p2 -batch -room |
bart | f06b427 | 2008-05-30 09:52:13 +0000 | [diff] [blame] | 75 | run_test splash2/codes/apps/radiosity/RADIOSITY -p4 -batch -room |