#!/bin/sh # run_encode_tests.sh - the encode/pile-up/heat run behind # docs/camera-capture-measurements.md, in order. ~90 min. Run in ~/fgc-bench (or # wherever encode_bench, frames/ and synth/ are), with the tower program stopped: # # nohup sh run_encode_tests.sh results > run.log 2>&1 & # # frames/ comes from camera_bench.py `save` (BayerRG8, BayerRG12p, RGB8); # synth/ from make_synthetic.py. Package power needs root to read: a root loop # copies the counter to /dev/shm/fgc_rapl until this script ends. set -u R=${1:-results} mkdir -p "$R" B=./encode_bench O=/tmp/encode-bench-out 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' & trap 'rm -f /dev/shm/fgc_rapl_run' EXIT export FGC_RAPL=/dev/shm/fgc_rapl sleep 1 step() { echo "$(date +%T) $*"; } step idle baseline $B idle frames $O 120 > "$R/idle_start.jsonl" step matrix real $B matrix frames $O > "$R/matrix_real.jsonl" step matrix synthetic $B matrix synth $O > "$R/matrix_synth.jsonl" # Maximum throughput, back to back. for cfg in "rgb8 4 0.8" "ea 4 0.8" "raw8 1 0"; do set -- $cfg for wt in "1 4" "2 2"; do set -- $cfg $wt step "max $1 workers=$4 threads=$5" $B pipeline synth $O "$1" "$4" "$5" 60 0 "$2" "$3" >> "$R/throughput.jsonl" done done # Pile-up: one frame per simulated waypoint. for cfg in "rgb8 4 0.8" "ea 4 0.8" "raw8 1 0"; do for period in 2000 1000 700; do set -- $cfg step "paced $1 period=$period" $B pipeline synth $O "$1" 1 4 120 "$period" "$2" "$3" >> "$R/pileup.jsonl" done done for period in 1000 700; do step "paced ea period=$period, 2 workers x 2 threads" $B pipeline synth $O ea 2 2 120 "$period" 4 0.8 >> "$R/pileup.jsonl" done step "paced ea period=1000, real frame" $B pipeline frames $O ea 1 4 120 1000 4 0.8 >> "$R/pileup_real.jsonl" # Heat: flat out, then a realistic waypoint pace, each after a cool-down. step cool-down $B idle frames $O 300 > "$R/idle_cool1.jsonl" step "heat: ea flat out 600 s" $B pipeline synth $O ea 1 4 600 0 4 0.8 > "$R/heat_max.jsonl" step cool-down $B idle frames $O 300 > "$R/idle_cool2.jsonl" step "heat: ea one frame per 2 s, 600 s" $B pipeline synth $O ea 1 4 600 2000 4 0.8 > "$R/heat_paced.jsonl" step done