mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-21 06:25:15 -04:00
42 lines
1.4 KiB
Bash
Executable file
42 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Little script to report a single benchmark number.
|
|
# Runs the benchmarks maxiter times, picks the best times for each benchmark, and reports the geomean.
|
|
#
|
|
|
|
# optional output postfix, useful to separate results of different benchmark runs
|
|
postfix=""
|
|
# used ranks, can be any value, by default the number of physical cores on the node
|
|
ranks=$(lscpu | awk '/^Core\(s\) per socket:/ {cores=$NF}; /^Socket\(s\):/ {sockets=$NF}; END{print cores*sockets}')
|
|
# adjust command for testing as needed
|
|
command="mpirun -np $ranks ../../../install/bin/cp2k.popt"
|
|
# iterations used for testing (best value retained for benchmark result)
|
|
maxiter=3
|
|
|
|
# benchmark files
|
|
benchs="bench_dftb dbcsr H2O-gga H2O-hyb"
|
|
|
|
# run benchmark iteration loop
|
|
for iter in $(seq 1 $maxiter)
|
|
do
|
|
echo "========= iter = $iter ========"
|
|
|
|
best=""
|
|
for bench in $benchs
|
|
do
|
|
# run benchmark
|
|
outfile=${bench}.out${postfix}
|
|
printf "%30s : " $bench
|
|
$command -i ${bench}.inp -o ${outfile} < /dev/null >& out.bench
|
|
|
|
# analyze results
|
|
grep " CP2K " ${outfile} | awk '{print $NF}' | sort -n | awk '{printf("%12.3f ",$1)}'
|
|
printf "\n"
|
|
bestbench=$(grep " CP2K " ${outfile} | awk '{print $NF}' | sort -nr | tail -n1)
|
|
best="$best $bestbench"
|
|
done
|
|
|
|
# report geomean of the best results
|
|
printf "%30s : " "geomean"
|
|
echo "$best" | awk 'BEGIN{t=1}{for(i=1;i<=NF;i++){t=t*$i} ; c=NF}END{printf("%12.3f\n",exp(log(t)/c))}'
|
|
done
|