File: do_benchmark

package info (click to toggle)
cp2k 2025.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 372,060 kB
  • sloc: fortran: 963,262; ansic: 64,495; f90: 21,676; python: 14,419; sh: 11,382; xml: 2,173; makefile: 996; pascal: 845; perl: 492; cpp: 345; lisp: 297; csh: 16
file content (42 lines) | stat: -rwxr-xr-x 1,436 bytes parent folder | download | duplicates (4)
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
#!/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 ../../../exe/local/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