open-standards/wai/research/determinism-cost/runs/linux-a-narrow-energy.sh
Transaction Science 61759c51b5 wai: the int_hyper decode on the narrow kernel sets, measured; determinism-tiers §7 quotes it
research/determinism-cost.md §4.6, in the same record and by the same
procedure: the 192 payloads decoded again on every platform with every
kernel set it runs (15 new runs, 0 decodes differing from the record's),
and the record's time and energy runs repeated in one session per host
beside the record's own build and the float decoder. On x86_64 host A the
integer decode on the narrow kernels took 144.8 ms and 12.43 J of marginal
package energy at quality 6 against 210.7 ms and 14.03 J for the float
decode beside it (the record's build: 728.0 ms, 92.14 J). On the build
host its own CPU energy fell from 11.01 J to 6.43 J at quality 6 and is
still above the float decode's 1.28 J by that count. Host B's integer
decode was measured before and after, without a float decode beside it.
The scripts that took the readings are in runs/; decode-throughput.md
notes the new sets; the changelog records the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 04:06:15 -04:00

30 lines
2.5 KiB
Shell

# Time and energy on x86_64 host A, DET1's procedure (linux-a-energy.sh): package energy (powercap
# package-0) around each of 7 rounds of the 8 pictures, 5 s idle brackets, at q2 and q6.
# Variants: int-before (DET1's binary), int-after (this change, kernel set auto, or KSET), float (again), int-gpu-after.
set -euo pipefail
R=$HOME/wai-build/idf; W=$R/work; export CARGO_TARGET_DIR=$R/target # the toolchain: rustup 1.98.0 on PATH
TAG=${TAG:?binary tag}; PY=$R/venv/bin/python; O=$R/energy; mkdir -p $O
cd $R/src/wai
IDS=$(python3 -c "import json;print(','.join(p['id'] for p in json.load(open('$W/pictures.json'))['pictures'][:8]))")
E="python3 -I tools/wai_det_energy.py --rounds ${ROUNDS:-7} --k 1 --idle-s 5 --counter rapl"
HW='"system": "Linux 7.0", "hardware": "x86_64 SoC, 16 cores, 32 threads, AVX-512, integrated GPU PCI vendor 0x1002", "pictures": 8'
D=$(date +%F)
for q in ${QS:-2 6}; do
for v in ${VARIANTS:-int-before int-after float}; do
case $v in
int-before) L=linux-int-cpu-q$q-before; CH="$R/bin/base serve $W/jobs.energy.q$q.tsv"; M='"path": "integer", "fabric": "CPU", "threads": "all (32)", "kernels": "the record'"'"'s (DET1 build, kernel set wide)"' ;;
int-after) K=${KSET:-auto}; L=linux-int-cpu-q$q-after${KSET:+-$KSET}; CH="env WAI_INT_ISA=$K $R/bin/native.$TAG serve $W/jobs.energy.q$q.tsv"; M='"path": "integer", "fabric": "CPU", "threads": "all (32)", "kernels": "narrow, kernel set '$K'"' ;;
int-gpu-after) L=linux-int-gpu-q$q-after; CH="env WAI_DET_GPU_KEY=gpu-vulkan-1002 $R/bin/gpu.$TAG --gpu serve $W/jobs.energy.q$q.tsv"; M='"path": "integer", "fabric": "GPU (Vulkan) for the graphs it takes, CPU for the rest", "threads": "all (32)", "kernels": "narrow, kernel set auto"' ;;
float) L=linux-float-cpu-q$q-again; CH="$PY -I tools/wai_determinism_cost.py fserve $W $q --device cpu --ids $IDS"; M='"path": "float", "fabric": "CPU", "threads": "the library default"' ;;
esac
$E --label $L --meta "{$HW, $M, \"quality\": $q, \"nice\": 10, \"measured\": \"$D\"}" -- nice -n 10 $CH > $O/$L.json
python3 - $O/$L.json <<'PY'
import json, sys, statistics as st
r = json.load(open(sys.argv[1]))
ms = [x["child_wall_ns"] / x["decodes"] / 1e6 for x in r["rounds"]]
j = [x["rapl"]["marginal_nj"] / x["decodes"] / 1e9 for x in r["rounds"]]
v = [x["rapl"].get("verdict") for x in r["rounds"]]
print(f'{r["label"]}: {st.median(ms):.1f} ms ({min(ms):.1f}-{max(ms):.1f}), {st.median(j):.2f} J ({min(j):.2f}-{max(j):.2f}), verdicts {v}')
PY
done
done