# Time and energy on the build host, DET1's procedure (macos-energy.sh): the decoder's own CPU # energy (per-task count) over each of 7 rounds of the 8 pictures, at q2 and q6. # Variants: int-before (DET1's binary), int-after (this change, kernel set auto, or KSET), float (again). set -euo pipefail TAG=${TAG:?binary tag} W=$RB_ROOT/det1/work; B=$RB_ROOT/idf/bin; PY=$RB_ROOT/venvs/sota-int/bin/python; O=$RB_ROOT/idf/energy; mkdir -p $O IDS=$(python3 -c "import json;print(','.join(p['id'] for p in json.load(open('$W/pictures.json'))['pictures'][:8]))") E="python3 -I wai/tools/wai_det_energy.py --rounds ${ROUNDS:-7} --k 1 --idle-s 5" HW='"system": "macOS 27.0.1", "hardware": "arm64 desktop SoC, 24 performance and 8 efficiency cores, 80-core integrated GPU", "pictures": 8' D=${MEASURED:-$(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=macos-int-cpu-q$q-before; CH="$RB_ROOT/det1/bin/wai_det_cost.native 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=macos-int-cpu-q$q-after${KSET:+-$KSET}; CH="env WAI_INT_ISA=$K $B/native.$TAG serve $W/jobs.energy.q$q.tsv"; M='"path": "integer", "fabric": "CPU", "threads": "all (32)", "kernels": "narrow, kernel set '$K'"' ;; float) L=macos-float-cpu-q$q-again; CH="$PY -I wai/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 --counter task --meta "{$HW, $M, \"quality\": $q, \"measured\": \"$D\"}" -- $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["task"]["energy_nj"] / x["decodes"] / 1e9 for x in r["rounds"]] la = [x["load_avg_before"][0] for x in r["rounds"]] print(f'{r["label"]}: {st.median(ms):.1f} ms ({min(ms):.1f}-{max(ms):.1f}), task {st.median(j):.2f} J ({min(j):.2f}-{max(j):.2f}), load {min(la):.0f}-{max(la):.0f}') PY done done