47 lines
1.4 KiB
Bash
47 lines
1.4 KiB
Bash
|
|
#!/usr/bin/env bash
|
|||
|
|
set -euo pipefail
|
|||
|
|
|
|||
|
|
# Mid/Large MT (8–32KiB) matrix runner
|
|||
|
|
# Usage: benchmarks/scripts/run_mid_large_mt_matrix.sh [threads_csv] [cycles] [ws] [reps]
|
|||
|
|
|
|||
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd)"
|
|||
|
|
cd "$ROOT_DIR"
|
|||
|
|
|
|||
|
|
threads_csv=${1:-"1,4"}
|
|||
|
|
cycles=${2:-40000}
|
|||
|
|
ws=${3:-2048}
|
|||
|
|
reps=${4:-5}
|
|||
|
|
|
|||
|
|
outdir="bench_results/auto/mid_large_mt_$(date +%Y%m%d_%H%M%S)"
|
|||
|
|
mkdir -p "$outdir"
|
|||
|
|
csv="$outdir/results.csv"
|
|||
|
|
echo "ts,scenario,threads,allocator,env,cycles,ws,rep,throughput_ops_s" >"$csv"
|
|||
|
|
|
|||
|
|
IFS=',' read -ra TLIST <<<"$threads_csv"
|
|||
|
|
|
|||
|
|
run_case() {
|
|||
|
|
local thr="$1"; shift
|
|||
|
|
local alloc="$1"; shift
|
|||
|
|
local envstr="$1"; shift
|
|||
|
|
local bin="$1"; shift
|
|||
|
|
for ((i=1;i<=reps;i++)); do
|
|||
|
|
local ts=$(date +%H%M%S)
|
|||
|
|
local out
|
|||
|
|
out=$($envstr "$bin" "$thr" "$cycles" "$ws" 42 2>/dev/null || true)
|
|||
|
|
local tput=$(echo "$out" | awk '/Throughput =/{print $3; exit}')
|
|||
|
|
if [[ -n "${tput:-}" ]]; then
|
|||
|
|
echo "$ts,mid_large_mt,$thr,$alloc,$(echo "$envstr" | sed 's/,/;/g'),$cycles,$ws,$i,$tput" >>"$csv"
|
|||
|
|
fi
|
|||
|
|
done
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[[ -x ./bench_mid_large_mt_system ]] || make -s bench_mid_large_mt_system >/dev/null
|
|||
|
|
[[ -x ./bench_mid_large_mt_hakmem ]] || make -s bench_mid_large_mt_hakmem >/dev/null
|
|||
|
|
|
|||
|
|
echo "[info] writing CSV to $csv"
|
|||
|
|
for t in "${TLIST[@]}"; do
|
|||
|
|
run_case "$t" "system" "env -i" ./bench_mid_large_mt_system
|
|||
|
|
run_case "$t" "hakmem" "env -i HAKMEM_WRAP_TINY=1" ./bench_mid_large_mt_hakmem
|
|||
|
|
done
|
|||
|
|
echo "[done] $csv"
|