hardware-counters
counter_sets.sh
#!/bin/bash
# Counter-set rotation for CrayPat profiling on ARCHER2 (AMD EPYC 7742 Rome)
# HW limit = 5 simultaneous HWPC counters; RAPL + ZenL3 use separate registers
# so they are appended to every set at no cost to the 5-counter budget.
EXTRA="cray_rapl:::PACKAGE_ENERGY,cray_rapl:::PP0_ENERGY,cray_zenl3:::UNC_L3_CACHE_MISSES,cray_zenl3:::UNC_L3_CACHE_REQUESTS,cray_zenl3:::UNC_L3_MISS_LATENCY"
case "$1" in
A) # compute / floating point
echo "PAPI_FP_OPS,PAPI_FP_INS,PAPI_TOT_INS,PAPI_TOT_CYC,${EXTRA}" ;;
B) # cache hierarchy
echo "PAPI_L2_DCM,PAPI_L2_DCH,PAPI_L1_DCA,PAPI_L2_DCR,PAPI_TOT_CYC,${EXTRA}" ;;
C) # memory bandwidth (predefined group)
echo "mem_bw,${EXTRA}" ;;
D) # dispatch stalls (predefined group)
echo "stalls,${EXTRA}" ;;
E) # branch + TLB
echo "PAPI_BR_INS,PAPI_BR_MSP,PAPI_TLB_DM,PAPI_TOT_CYC,PAPI_TOT_INS,${EXTRA}" ;;
*) echo "usage: $0 {A|B|C|D|E}" >&2; exit 1 ;;
esac