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 / omegese45 / core / build.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: AGPL-3.0-only |
| 3 | # Build the omegese45 pipeline binaries (aien-train #45, pipeline lane). |
| 4 | # OMC=<omc bf54b19f> OMEGA=<omega-mv checkout with bf54b19f> OUT=<dir> sh tests/omegese45/core/build.sh [MODEL.om] |
| 5 | # Writes $OUT/oe45gen (generator), $OUT/oe45core (CLI), $OUT/oe45test (test driver) and |
| 6 | # $OUT/oe45mut (fault injector). MODEL.om (default native/omegese45/core/model.om) lets the |
| 7 | # suite build mutants. Host glue only: the pinned SHA unit comes from its exact Git object |
| 8 | # (native/omegese45/core/dependencies.json, sha256 checked); its `export fn` lines become |
| 9 | # `fn` (program mode refuses export), and OM-2 requires it first in the unit. |
| 10 | set -u |
| 11 | ROOT=$(cd "$(dirname "$0")/../../.." && pwd) |
| 12 | : "${OMC:?}" "${OMEGA:?}" "${OUT:?}" |
| 13 | mkdir -p "$OUT" |
| 14 | N=$ROOT/native/omegese45 |
| 15 | MODEL=${1:-$N/core/model.om} |
| 16 | DEPS=$N/core/dependencies.json |
| 17 | [ "$(sha256sum "$OMC" | cut -d' ' -f1)" = "$(jq -r .compiler.binary_sha256 "$DEPS")" ] || { echo "BUILD_FAIL omc-sha256"; exit 1; } |
| 18 | commit=$(jq -r '.dependencies[0].commit' "$DEPS") |
| 19 | path=$(jq -r '.dependencies[0].path' "$DEPS") |
| 20 | sum=$(jq -r '.dependencies[0].sha256' "$DEPS") |
| 21 | git -C "$OMEGA" show "$commit:$path" > "$OUT/sha256-om2.om" || { echo "BUILD_FAIL sha-unit-missing"; exit 1; } |
| 22 | echo "$sum $OUT/sha256-om2.om" | sha256sum -c --status || { echo "BUILD_FAIL sha-unit-sha256"; exit 1; } |
| 23 | sed 's/^export fn /fn /' "$OUT/sha256-om2.om" > "$OUT/sha-prog.om" |
| 24 | cat "$N/vocab.om" "$N/msg.om" "$N/data/gen.om" > "$OUT/gen.unit.om" |
| 25 | cat "$OUT/sha-prog.om" "$N/vocab.om" "$N/msg.om" "$MODEL" "$N/core/ckpt.om" \ |
| 26 | "$N/core/run.om" "$N/core/cli.om" > "$OUT/core.unit.om" |
| 27 | cat "$OUT/sha-prog.om" "$N/vocab.om" "$N/msg.om" "$MODEL" "$N/core/ckpt.om" \ |
| 28 | "$N/core/run.om" "$ROOT/tests/omegese45/core/main.om" > "$OUT/test.unit.om" |
| 29 | cp "$ROOT/tests/omegese45/core/mutate.om" "$OUT/mut.unit.om" |
| 30 | for u in gen core test mut; do |
| 31 | "$OMC" < "$OUT/$u.unit.om" > "$OUT/oe45$u" 2> "$OUT/$u.compile.stderr" |
| 32 | rc=$? |
| 33 | [ "$rc" = 0 ] || { echo "BUILD_FAIL $u rc=$rc $(cat "$OUT/$u.compile.stderr")"; exit 1; } |
| 34 | [ "$(od -An -tx1 -N4 "$OUT/oe45$u" | tr -d ' ')" = 7f454c46 ] || { echo "BUILD_FAIL $u not-elf"; exit 1; } |
| 35 | chmod 700 "$OUT/oe45$u" |
| 36 | done |
| 37 | echo BUILD_OK |