# Time and energy on the build host (macOS): the integer decode on the CPU and with its graphs on # the GPU, the float decode on the CPU and on the GPU; 8 pictures per round, 7 rounds, at q2 and q6. set -euo pipefail W=$RB_ROOT/det1/work; B=$RB_ROOT/det1/bin; PY=$RB_ROOT/venvs/sota-int/bin/python; O=$W/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' for q in ${QS:-2 6}; do python3 - "$W" "$q" "$IDS" > $W/jobs.energy.q$q.tsv <<'PY' import sys w, q, ids = sys.argv[1], sys.argv[2], sys.argv[3].split(",") for i in ids: print(f"{w}/sets/q{q}\t{w}/int/q{q}/{i}.wih1\t-") PY for v in ${VARIANTS:-int-cpu float-cpu float-gpu int-gpu}; do case $v in int-cpu) C="--counter task"; CH="$B/wai_det_cost.native serve $W/jobs.energy.q$q.tsv"; M='"path": "integer", "fabric": "CPU", "threads": "all (32)"' ;; int-gpu) C="--counter task --counter ioreport-gpu"; CH="$B/wai_det_cost.gpu --gpu serve $W/jobs.energy.q$q.tsv"; M='"path": "integer", "fabric": "GPU (Metal) for the graphs it takes, CPU for the rest", "threads": "all (32)"' ;; float-cpu) C="--counter task"; 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"' ;; float-gpu) C="--counter task --counter ioreport-gpu"; CH="$PY -I wai/tools/wai_determinism_cost.py fserve $W $q --device mps --ids $IDS"; M='"path": "float", "fabric": "GPU (Metal) through the library, CPU for the entropy decode", "threads": "the library default"' ;; esac $E --label macos-$v-q$q $C --meta "{$HW, $M, \"quality\": $q}" -- $CH > $O/macos-$v-q$q.json done done ls -la $O