summaryrefslogtreecommitdiff
path: root/src/eval_tune/run_ecm.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval_tune/run_ecm.sh')
-rwxr-xr-xsrc/eval_tune/run_ecm.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/eval_tune/run_ecm.sh b/src/eval_tune/run_ecm.sh
new file mode 100755
index 0000000..a6c1284
--- /dev/null
+++ b/src/eval_tune/run_ecm.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Run the ECM tactical suite at a fixed search depth (not fixed time --
+# see CLAUDE.md: st introduces machine-load noise that sd avoids) and
+# print just the "correct solutions" tally so callers can parse it.
+#
+# Usage: run_ecm.sh <label> [depth]
+# Writes eval_tune/ecm_logs/<label>.log (full Trace() output) and
+# appends one line to eval_tune/ecm_history.log.
+
+set -e
+cd "$(dirname "$0")/.." # repo src/ root
+
+label="$1"
+depth="${2:-11}"
+if [ -z "$label" ]; then
+ echo "Usage: $0 <label> [depth]" >&2
+ exit 1
+fi
+
+mkdir -p eval_tune/ecm_logs
+logfile="eval_tune/ecm_logs/${label}.log"
+
+opts='--cpus 1 --hash 256m --egtbpath /zscratch/egtb'
+# --batch exits non-zero on normal EOF ("Exhausted input in batch
+# mode") -- that's expected, not a failure, so don't let set -e treat
+# it as one; the real success/failure check is the grep below.
+./typhoon ${opts} --logfile "$logfile" --batch \
+ --command "sd ${depth}; script ../tests/ecm.ep_" || true
+
+correct=$(grep -o 'correct solutions : [0-9]*' "$logfile" | tail -1 | grep -o '[0-9]*$')
+total=$(grep -o 'total problems : [0-9]*' "$logfile" | tail -1 | grep -o '[0-9]*$')
+
+if [ -z "$correct" ] || [ -z "$total" ]; then
+ echo "ERROR: couldn't parse solved count from $logfile" >&2
+ exit 1
+fi
+
+echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) label=$label depth=$depth solved=${correct}/${total}" \
+ >> eval_tune/ecm_history.log
+
+echo "${correct} ${total}"