forked from intel/yask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.sh
executable file
·52 lines (49 loc) · 1.83 KB
/
benchmark.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
#!/bin/bash
runs=$1
iter=$2
size=$3
arch=$4
stencil=$5
echo "radius" | xargs printf "%-10s"
echo "time" | xargs printf "%-15s"
echo "points" | xargs printf "%-15s"
echo "flops" | xargs printf "%-15s"
echo "power" | xargs printf "%-15s"
echo
for i in {1..4}
do
timesum=0
pointsum=0
flopssum=0
powersum=0
make clean >/dev/null 2>&1; make stencil=$stencil arch=$arch radius=$i -j 6 >/dev/null 2>&1
if [ "$arch" == "knl" ]
then
out=`sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:lib/ numactl --preferred=1 bin/yask_kernel.$stencil.$arch.exe -d $size -t $runs -dt $iter`
else
out=`sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:lib/ numactl --cpunodebind=0 bin/yask_kernel.$stencil.$arch.exe -d $size -t $runs -dt $iter`
fi
for (( k=1; k<=$runs; k++ ))
do
time=`echo "$out" | grep elapsed-time -m1 | tail -n1 | cut -d ":" -f 2 | tr -d '[:space:]'`
temp=`echo "$out" | grep throughput | grep "num-points" -m $k | tail -n 1 | cut -d ":" -f 2 | tr -d '[:space:]' | numfmt --from=auto`
point=`echo "scale=3; $temp/1000000000.0" | bc -l`
temp=`echo "$out" | grep FLOPS -m $k | tail -n 1 | cut -d ":" -f 2 | tr -d '[:space:]' | numfmt --from=auto`
flops=`echo "scale=3; $temp/1000000000.0" | bc -l`
power=`echo "$out" | grep average-power -m1 | tail -n1 | cut -d ":" -f 2 | tr -d '[:space:]'`
timesum=`echo $timesum+$time | bc -l`
pointsum=`echo $pointsum+$point | bc -l`
flopssum=`echo $flopssum+$flops | bc -l`
powersum=`echo $powersum+$power | bc -l`
done
timeaverage=`echo $timesum/$runs | bc -l`
pointaverage=`echo $pointsum/$runs | bc -l`
flopsaverage=`echo $flopssum/$runs | bc -l`
poweraverage=`echo $powersum/$runs | bc -l`
echo $i | xargs printf "%-10s"
echo $timeaverage | xargs printf "%-15.3f"
echo $pointaverage | xargs printf "%-15.3f"
echo $flopsaverage | xargs printf "%-15.3f"
echo $poweraverage | xargs printf "%-15.3f"
echo
done