aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / tests / omegallm / efi-ref.sh
| 1 | #!/bin/sh |
| 2 | # Run an ollm JOB.TXT (the UEFI job format, CONTRACT section 9) with a Linux ollm build, to give the |
| 3 | # reference the UEFI run's OUT.TXT is compared with. |
| 4 | # Usage: sh tests/omegallm/efi-ref.sh BIN JOB DIR |
| 5 | # Prints, per job, `> line` and the command's output (with a line feed added when it does not end in |
| 6 | # one), like OUT.TXT without its `OLLM efi`, `ID` (identity), `J` and `OLLM DONE` lines; stops at the |
| 7 | # first command that exits nonzero (as the UEFI app does) and then prints `rc=N`. As in eio.om main: |
| 8 | # empty lines and lines starting with # are skipped; a line of only spaces and tabs has no tokens, so |
| 9 | # it is echoed as `> line` and runs nothing (no output, no J line in OUT.TXT, not counted as a job). |
| 10 | # Env: CORE (taskset core, default 6). The job lines are trusted (shell-split). |
| 11 | set -u |
| 12 | [ $# -eq 3 ] || { echo "usage: efi-ref.sh BIN JOB DIR" >&2; exit 2; } |
| 13 | BIN=$1 JOB=$2 DIR=$3 |
| 14 | CORE=${CORE:-6} |
| 15 | ws=$(printf ' \t') |
| 16 | o=$(mktemp) |
| 17 | trap 'rm -f "$o"' EXIT HUP INT TERM |
| 18 | tr -d '\r' < "$JOB" | while IFS= read -r line; do |
| 19 | case "$line" in '' | '#'*) continue ;; esac |
| 20 | printf '> %s\n' "$line" |
| 21 | case "$line" in *[!"$ws"]*) ;; *) continue ;; esac |
| 22 | args=$(printf '%s\n' "$line" | sed 's/\\OLLM\\/'"$(printf '%s' "$DIR/" | sed 's/[\/&]/\\&/g')"'/g') |
| 23 | eval "set -- $args" |
| 24 | taskset -c "$CORE" nice -n 19 "$BIN" "$@" > "$o" |
| 25 | rc=$? |
| 26 | cat "$o" |
| 27 | [ ! -s "$o" ] || [ "$(tail -c 1 "$o" | od -An -tu1 | tr -d ' ')" = 10 ] || echo |
| 28 | [ "$rc" = 0 ] || { echo "rc=$rc"; exit 1; } |
| 29 | done |