-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench_scan_size.sh
executable file
·59 lines (50 loc) · 2.16 KB
/
bench_scan_size.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
53
54
55
56
57
58
59
#!/bin/sh
#Usage ./bench_scan_size.sh <config_file>
#benches="load_avx512 load copy_avx512 copy_mem_avx512 copy daxpy_avx512_fma stream_avx512_fma stream_mem_avx512 triad_avx512_fma triad_mem_avx512_fma update_avx512"
benches=`cat $1 | grep BENCHES | cut -d "=" -f 2-`
postfixes=`cat $1 | grep POSTFIX | cut -d "=" -f 2-`
# bytes="8 8 24 16 24 24 32 24 40 32 16"
folder=`cat $1 | grep FOLDER | cut -d "=" -f 2-`
rawFolder="${folder}/raw"
clock=`cat $1 | grep CLOCK | cut -d "=" -f 2-`
tmpFile="${folder}/tmp.txt"
endSize=`cat $1 | grep END_SIZE | cut -d "=" -f 2-`
#TODO check freq also in check-state
./check-state.sh $1
mc_state=$(echo $?)
if [[ ${mc_state} == 1 ]]; then
echo "Hardware not configured properly"
exit 1
fi
mkdir -p ${rawFolder}
#store machine config
./machine-state.sh > "${rawFolder}/mc-state.txt"
for postfix in $postfixes; do
for bench in $benches; do
benchName="${bench}_${postfix}"
outFolder="${folder}/${postfix}"
mkdir -p ${outFolder}
outFile="${outFolder}/${benchName}.txt"
rawFile="${rawFolder}/${benchName}.txt"
printf "%10s, %14s, %16s, %16s, %16s, %16s\n" "Size(KB)" "Bw(MB/s)" "nominal_clock" "actual_clock" "cy_nominal/LUP" "cy/LUP" > ${outFile}
size=5
while [[ ${size} -lt ${endSize} ]]; do
likwid-bench -t ${benchName} -w S0:${size}kB:1:1:2 2 > ${tmpFile}
cat ${tmpFile} >> ${rawFile}
bw=$(cat ${tmpFile} | grep "MByte/s:" | cut -d":" -f2)
nominalClock_hz=$(cat ${tmpFile} | grep "CPU Clock:" | cut -d":" -f2)
nominalClock=$(echo "${nominalClock_hz}*0.000000001" | bc -l)
cy_nominal=$(cat ${tmpFile} | grep "Cycles per update:" | cut -d":" -f2) #this is at nominal clock
cy=$(echo "${cy_nominal}*${clock}/${nominalClock}" | bc -l)
printf "%10d, %14.4f, %16.8f, %16.8f, %16.8f, %16.8f\n" ${size} ${bw} ${nominalClock} ${clock} ${cy_nominal} ${cy} >> ${outFile}
size_float=$(echo "${size}*1.2" | bc -l)
size=$(printf "%.0f" ${size_float})
#monitor with LIKWID too
done
done
done
rm -rf ${tmpFile}
cd ${folder}
tar -czvf raw.tar.gz raw
rm -rf raw
cd -