48 lines
1.3 KiB
Bash
48 lines
1.3 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# Sweep Tiny hot-path microbench across sizes/batches and save CSV
|
||
|
|
# Usage: scripts/run_tiny_hot_sweep.sh [cycles]
|
||
|
|
|
||
|
|
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||
|
|
cd "$ROOT_DIR"
|
||
|
|
|
||
|
|
cycles=${1:-200000}
|
||
|
|
|
||
|
|
echo "[info] Building tiny hot benches (bench_fast)"
|
||
|
|
make -s bench_fast >/dev/null
|
||
|
|
|
||
|
|
TS=$(date +%Y%m%d_%H%M%S)
|
||
|
|
OUTDIR="bench_results/tiny_hot_${TS}"
|
||
|
|
mkdir -p "$OUTDIR"
|
||
|
|
CSV="$OUTDIR/results.csv"
|
||
|
|
echo "mode,size,batch,cycles,throughput_mops" > "$CSV"
|
||
|
|
|
||
|
|
sizes=(8 16 24 32 40 48 56 64 128)
|
||
|
|
batches=(50 100 200)
|
||
|
|
|
||
|
|
run_case() {
|
||
|
|
local mode="$1"; shift
|
||
|
|
local size="$1"; shift
|
||
|
|
local batch="$1"; shift
|
||
|
|
local cyc="$1"; shift
|
||
|
|
local bin
|
||
|
|
if [[ "$mode" == "hakmem" ]]; then bin="./bench_tiny_hot_hakmem"; else bin="./bench_tiny_hot_system"; fi
|
||
|
|
local out
|
||
|
|
out=$($bin "$size" "$batch" "$cyc" | sed -n 's/^Throughput: \([0-9.][0-9.]*\) M ops.*/\1/p' || true)
|
||
|
|
if [[ -n "$out" ]]; then echo "$mode,$size,$batch,$cyc,$out" >> "$CSV"; fi
|
||
|
|
}
|
||
|
|
|
||
|
|
for s in "${sizes[@]}"; do
|
||
|
|
for b in "${batches[@]}"; do
|
||
|
|
echo "[run] HAKMEM size=$s batch=$b cycles=$cycles"
|
||
|
|
run_case hakmem "$s" "$b" "$cycles"
|
||
|
|
echo "[run] SYSTEM size=$s batch=$b cycles=$cycles"
|
||
|
|
run_case system "$s" "$b" "$cycles"
|
||
|
|
done
|
||
|
|
done
|
||
|
|
|
||
|
|
echo "[done] CSV: $CSV"
|
||
|
|
grep -E '^(mode|hakmem)' "$CSV" | sed -n '1,20p' || true
|
||
|
|
|