fwt_software/tools/camera-bench/run_raw12_encode.sh

78 lines
2.8 KiB
Bash

#!/bin/sh
# run_raw12_encode.sh - processing half of docs/raw12-pipeline-measurements.md:
# checks, the stage-by-stage matrix on the real and the synthetic frame,
# example files, throughput, pile-up at scan paces, and heat. ~2 h. Run after
# run_raw12_camera.sh (which leaves frames/), with synth/ from
# make_synthetic.py and the tower program still stopped:
#
# nohup sh run_raw12_encode.sh results > encode.log 2>&1 &
#
# 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=./raw12_bench
O=/tmp/raw12-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 checks
$B check frames $O > "$R/check.jsonl"
step "examples (real frame)"
rm -rf examples
$B examples frames examples > "$R/examples.jsonl"
step "matrix real"
$B matrix frames $O > "$R/matrix_real.jsonl"
step "matrix synthetic"
$B matrix synth $O > "$R/matrix_synth.jsonl"
# Back to back, 60 s: kind effort distance workers threads
for cfg in "c12_ea 3 1.0 1 4" "c12_ea 3 1.0 2 2" "c12_ea 3 1.0 4 1" \
"c12_ea 3 0.5 1 4" "c12_ea 3 0.5 2 2" \
"rgb8 4 0.8 1 4" "rgb8 4 0.8 2 2" \
"raw12 1 0 1 4" "raw12_planes 1 0 1 4"; do
set -- $cfg
step "max $1 e$2 d$3 workers=$4 threads=$5"
$B pipeline synth $O "$1" "$4" "$5" 60 0 "$2" "$3" >> "$R/throughput.jsonl"
done
# One frame per simulated waypoint, 120 s: kind effort distance workers threads periods
for cfg in "c12_ea 3 1.0 1 4|2000 1500 1000 700" "c12_ea 3 0.5 1 4|1000 700" \
"c12_ea 3 1.0 2 2|1000 700 500" "c12_ea 3 0.5 2 2|700" \
"rgb8 4 0.8 1 4|2000 1000 700" "raw12 1 0 1 4|1000 700"; do
params=${cfg%|*}
periods=${cfg#*|}
set -- $params
for p in $periods; do
step "paced $1 e$2 d$3 workers=$4 threads=$5 period=$p"
$B pipeline synth $O "$1" "$4" "$5" 120 "$p" "$2" "$3" >> "$R/pileup.jsonl"
done
done
step "paced c12_ea real frame period=1000"
$B pipeline frames $O c12_ea 1 4 120 1000 3 1.0 >> "$R/pileup_real.jsonl"
step cool-down
$B idle frames $O 300 > "$R/idle_cool1.jsonl"
step "heat: c12_ea 2x2 flat out 600 s"
$B pipeline synth $O c12_ea 2 2 600 0 3 1.0 > "$R/heat_max.jsonl"
step cool-down
$B idle frames $O 300 > "$R/idle_cool2.jsonl"
step "heat: c12_ea 1x4 one frame per 2 s, 600 s"
$B pipeline synth $O c12_ea 1 4 600 2000 3 1.0 > "$R/heat_paced.jsonl"
rm -rf $O
step done