#!/bin/bash # 20160823 # Usage: filter-timing.sh function get_hpl_arch() { local OUT=${1:?Output file required as arg 1} awk ' $1 ~ /HPL_ARCH=.+/ { HPL_ARCH = $1 sub(/^.*=/, "", HPL_ARCH) exit } $0 ~ /declare -x HPL_ARCH=/ { HPL_ARCH = $0 sub(/^.*HPL_ARCH=/, "", HPL_ARCH) sub(/^"/, "", HPL_ARCH) sub(/"$/, "", HPL_ARCH) exit } /Executable-info::/ { getline # ls -l info getline # md5sum info ExeName = $3 if (ExeName ~ /Linux_/) { HPL_ARCH = ExeName sub(/^.*Linux_/, "Linux_", HPL_ARCH) sub(/[ ./].*$/, "", HPL_ARCH) } } END { if (HPL_ARCH) print(HPL_ARCH) } ' "$OUT" } function report_hpl_summary1() { local OUT=${1:?Output file required as arg 1} RES1=$(awk ' BEGIN { count_nodetype[-1] = 0 known_hosts = "c6 c8 cr crgpu crhimem crphi d430 d730" } /^SGE-host-files::/, /^$/ { print; if (NF == 4) { numhosts += 1 numprocs += $2 hostname = $1 nodetype = $1; sub(/-.*$/, "", nodetype) if (!(nodetype in count_nodetype)) { ncount += 1 list_nodetype[ncount] = nodetype } count_nodetype[nodetype] += 1 } filename = FILENAME } END { asort(list_nodetype) nodestr = "" for (i = 1; i <= ncount; ++i) { nt = list_nodetype[i] ct = count_nodetype[nt] nodestr = (nodestr "," nt "(" ct ")") } nodestr = substr(nodestr, 2) print(nodestr) printf("%-32s %4d %4d\n", filename, numprocs, numhosts) } ' "$OUT") echo "$RES1" RES2=$(grep "^WR[0-9][0-9]" "$OUT" | sort -gk 7) echo "$RES2" RES3=$(echo "$RES2" | tail -n 1 | awk ' { Code = $1 N = $2 NB = $3 P = $4 Q = $5 Time = $6 GFLOPS = $7 printf("%-8s %7d %4d %3d %3d %9s %9.4g\n", Code, N, NB, P, Q, Time, GFLOPS) } ') HPL_ARCH=$(get_hpl_arch "$OUT") # Example output (w RES2) #HPL: test-hpl05.o180978 64 8 WR01C2C2 79000 128 8 8 297.72 1.104e+03 c6(8) # Example output (w RES3 & HPL_ARCH) #HPL: test-hpl05.o176526 64 12 WR01C2C4 79000 128 8 8 335.97 978.4 c6(6),c8(6) Linux_turing_gcc49_ompi110_mkl11 echo "" echo -n "HPL: " echo -n "$RES1" | tail -n 1 echo -n " " #echo -n "$RES2" | tail -n 1 echo -n "$RES3" echo -n " " printf "%-25s %s\n" \ $(echo "$RES1" | tail -n 2 | head -n 1) \ "$HPL_ARCH" } # Main program : ${VERBOSE=0} if [ "$VERBOSE" = 1 ]; then for fn in "$@"; do report_hpl_summary1 "$fn" echo "" done else echo "HPL> jobcode nprocs nodes calccode N NB P Q Time_s GFLOPS nodetypes HPL_ARCH" # HPL: test-hpl05.o176526 64 12 WR01C2C4 79000 128 8 8 335.97 978.4 c6(6),c8(6) Linux_turing_gcc49_ompi110_mkl11 for fn in "$@"; do report_hpl_summary1 "$fn" | tail -n 1 done fi