#!/bin/sh # Throttling matrix on tower 111 (3 Delta, N5105): the 12-bit save pipeline under # clock caps, a power cap and competing load. Tower program stopped. ~25 min. # nohup sh ~/thermal-test/matrix.sh > ~/thermal-test/matrix.log 2>&1 & set -u cd ~/fgc-bench R=~/thermal-test/results-tower111 O=/tmp/thermal-bench-out B=./raw12_bench SIM=~/thermal-test/software/tools/thermal-sim mkdir -p "$R" restore() { sudo -n "$SIM/cap-cpu.sh" restore sudo -n "$SIM/cap-power.sh" restore pkill -f "stress-ng --cpu" 2>/dev/null rm -f /dev/shm/fgc_rapl_run rm -rf "$O" } trap restore EXIT INT TERM touch /dev/shm/fgc_rapl_run sudo -n sh -c 'while [ -e /dev/shm/fgc_rapl_run ]; do cat /sys/class/powercap/intel-rapl:0/energy_uj > /dev/shm/fgc_rapl.tmp && chmod 644 /dev/shm/fgc_rapl.tmp && mv /dev/shm/fgc_rapl.tmp /dev/shm/fgc_rapl sleep 0.25; done; rm -f /dev/shm/fgc_rapl' & export FGC_RAPL=/dev/shm/fgc_rapl sleep 1 step() { echo "$(date +%T) $*"; } counts() { echo "$(date +%T) throttle counts: package $(cat /sys/devices/system/cpu/cpu0/thermal_throttle/package_throttle_count)" \ "cores $(cat /sys/devices/system/cpu/cpu*/thermal_throttle/core_throttle_count | tr '\n' ' ')" \ "temp $(cat /sys/class/thermal/thermal_zone2/temp)" } # label: flat-out 60 s, then one frame per 2 s for 120 s run() { step "$1: flat out 60 s"; counts $B pipeline synth $O c12_ea 1 4 60 0 3 1.0 > "$R/$1_flat.jsonl" step "$1: paced 2000 ms 120 s"; counts $B pipeline synth $O c12_ea 1 4 120 2000 3 1.0 > "$R/$1_paced.jsonl" counts } cool() { step "cool-down $1 s"; $B idle synth $O "$1" > "$R/idle_$2.jsonl"; } cool 60 start run none cool 60 a for mhz in 1600 1200 800; do sudo -n "$SIM/cap-cpu.sh" "$mhz" run "cap${mhz}" sudo -n "$SIM/cap-cpu.sh" restore cool 60 "after${mhz}" done sudo -n "$SIM/cap-power.sh" 6 run power6w sudo -n "$SIM/cap-power.sh" restore cool 60 afterpower step "load2: 2 busy cores, paced 2000 ms 120 s"; counts stress-ng --cpu 2 --timeout 125s --quiet & sp=$! # only this: a bare `wait` also waits for the power-reading loop, forever sleep 2 $B pipeline synth $O c12_ea 1 4 120 2000 3 1.0 > "$R/load2_paced.jsonl" wait "$sp" counts cool 60 afterload sudo -n "$SIM/cap-cpu.sh" 800 step "cap800+load2: paced 2000 ms 120 s"; counts stress-ng --cpu 2 --timeout 125s --quiet & sp=$! # only this: a bare `wait` also waits for the power-reading loop, forever sleep 2 $B pipeline synth $O c12_ea 1 4 120 2000 3 1.0 > "$R/cap800load2_paced.jsonl" wait "$sp" counts sudo -n "$SIM/cap-cpu.sh" restore step done