aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/041-batches/runs.sh
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-05 22:56:44 +0100
committereunhhu <[email protected]>2026-10-05 22:56:44 +0100
commitd85f2e13cb02c70550ca42dd6acba7a4937c9d7f (patch)
treeba369ada666406543f6262108144790e0079bdb3 /research/experiments/041-batches/runs.sh
parent10a50dd20abe8542d6ed6487d2c46d964af59c75 (diff)
downloadpure-d85f2e13cb02c70550ca42dd6acba7a4937c9d7f.tar.gz
pure-d85f2e13cb02c70550ca42dd6acba7a4937c9d7f.zip
041 runs.sh: the suite three ways (the compiled code, the executor with batches, the executor alone) and icount.c's instructions and cycles; stage 1 at 10a50dd: knapsack 13.57 ms with batches (1,040.9 alone, 7.52 compiled, C 6.23), the others as they were; the executor's instructions as e2e56dd's or fewer (roots 2.756 to 2.760 billion, cycles alike), knapsack's 21.7 to 0.46 billion with batches
Diffstat (limited to 'research/experiments/041-batches/runs.sh')
-rwxr-xr-xresearch/experiments/041-batches/runs.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/research/experiments/041-batches/runs.sh b/research/experiments/041-batches/runs.sh
new file mode 100755
index 0000000..190a3d2
--- /dev/null
+++ b/research/experiments/041-batches/runs.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# The batch executor's runs (docs/design/024), from the repository's root,
+# on builds made by 040's runs.sh build (~/.cache/pure-040/NAME), under
+# research/guard.py on a quiet Pi:
+# runs.sh suite NAME ROUNDS [WORK ...] the suite on NAME three ways: the
+# compiled code (jit), the executor
+# with its batches (batches,
+# PURE_JIT=0), the executor alone
+# (rounds, PURE_BATCH=0 too)
+# runs.sh counts NAME [WORK ...] user-mode instructions and cycles
+# of suite-run's 3 rounds, each of
+# the two executor ways (icount.c)
+set -e
+here=research/experiments/041-batches
+builds=$HOME/.cache/pure-040
+day=$(date +%F)
+quiet() { until awk '{ exit !($1 < 1.5) }' /proc/loadavg; do sleep 10; done; }
+mode=$1 name=$2
+shift 2
+case "$mode" in
+suite)
+ rounds=$1
+ shift
+ for way in jit batches rounds; do
+ quiet
+ echo "$name $way $(uptime)" >> "$here/$day-load.txt"
+ case $way in
+ jit) PURE_JIT=1 python3 research/guard.py --most 3072 -- "$builds/$name/suite-run" "$builds/$name" "$rounds" "$@" ;;
+ batches) PURE_JIT=0 python3 research/guard.py --most 3072 -- "$builds/$name/suite-run" "$builds/$name" "$rounds" "$@" ;;
+ rounds) PURE_JIT=0 PURE_BATCH=0 python3 research/guard.py --most 3072 -- "$builds/$name/suite-run" "$builds/$name" "$rounds" "$@" ;;
+ esac | sed "s/^{/{\"version\":\"$name\",\"way\":\"$way\",/" >> "$here/$day-suite.jsonl"
+ done ;;
+counts)
+ cc -O2 -o "$builds/icount" $here/icount.c
+ for work in "$@"; do
+ for way in batches rounds; do
+ quiet
+ batch=1
+ [ $way = rounds ] && batch=0
+ PURE_JIT=0 PURE_BATCH=$batch "$builds/icount" "$builds/$name/suite-run" "$builds/$name" 3 "$work" 2>&1 >/dev/null \
+ | sed "s/^{/{\"version\":\"$name\",\"way\":\"$way\",\"work\":\"$work\",/" >> "$here/$day-counts.jsonl"
+ done
+ done ;;
+*) echo "runs.sh suite NAME ROUNDS [WORK ...] | counts NAME [WORK ...]" >&2
+ exit 2 ;;
+esac