#!/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