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 / demo / setup-runtime.sh
| 1 | #!/bin/sh |
| 2 | # OE45 demo runtime setup: existing Aienet-0 components only (no new executor, |
| 3 | # receipt issuer, scheduler, judge or ledger). |
| 4 | # |
| 5 | # usage: tests/omegese45/demo/setup-runtime.sh RT |
| 6 | # |
| 7 | # Builds into RT (idempotent; a finished RT/pins.env is reused after its pins |
| 8 | # are rechecked): |
| 9 | # RT/bin/aienet0-run, RT/bin/aienet0-serve open-humanity 53c39bf2031c, cargo --release --locked |
| 10 | # RT/bin/matmul_u32_recompute aien-protocols e705fdc9 specs/aienet/jobpath/build.sh, |
| 11 | # pinned omc 2c824805...029f, SHA unit dbf002dd... (omega-mv 55845e70) |
| 12 | # RT/keys RT/pins RT/wkeys RT/wpins test identities, generated as in aien-protocols |
| 13 | # evidence/aienet0-ledger-auth-20261028/receipt.txt:38-43 |
| 14 | # RT/pins.env every pin and binary sha256 (sourced by run-demo.sh) |
| 15 | # Environment (optional): |
| 16 | # OMC_PINNED pinned omc 2c824805 (default /home/drakestapleton/workspace/omega-mcp/build/omc; copied, never modified) |
| 17 | # OMEGA_MV_GIT an omega-mv git dir holding commit 55845e70 (default /tmp/om-main) |
| 18 | # Exit: 0 ready; 3 NOT_RUN (a pin differs or a source is missing); 60 build failure. |
| 19 | set -eu |
| 20 | RT=${1:?usage: setup-runtime.sh RT} |
| 21 | OH_REPO=https://github.com/aien-dev/open-humanity |
| 22 | OH_PIN=53c39bf2031c |
| 23 | PROTO_REPO=https://github.com/aien-dev/aien-protocols |
| 24 | PROTO_PIN=e705fdc9 |
| 25 | OMC_PIN=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f |
| 26 | SHA_UNIT_COMMIT=55845e707dac0d09bf22b5e16970a73c0a989a8c |
| 27 | RECOMPUTE_PIN=d2cd7382e0dc64e49498ae3b1ceffc73f1ddcbd3ddcf93e6d607498ccd58ea12 |
| 28 | OMC_PINNED=${OMC_PINNED:-/home/drakestapleton/workspace/omega-mcp/build/omc} |
| 29 | OMEGA_MV_GIT=${OMEGA_MV_GIT:-/tmp/om-main} |
| 30 | HEAVY="taskset -c ${AIEN_TEST_CPUS:-0-9,15-19} nice -n 19 ionice -c3" |
| 31 | sha() { sha256sum < "$1" | cut -c1-64; } |
| 32 | mkdir -p "$RT/bin" "$RT/src" "$RT/log" |
| 33 | RT=$(cd "$RT" && pwd) |
| 34 | |
| 35 | if [ ! -x "$RT/bin/aienet0-run" ] || [ ! -x "$RT/bin/aienet0-serve" ]; then |
| 36 | [ -d "$RT/src/open-humanity/.git" ] || git clone -q "$OH_REPO" "$RT/src/open-humanity" |
| 37 | git -C "$RT/src/open-humanity" checkout -q "$OH_PIN" |
| 38 | ( cd "$RT/src/open-humanity" && |
| 39 | $HEAVY cargo build --release --locked -j 2 -p oh-coordinator -p oh-volunteer \ |
| 40 | --bin aienet0-run --bin aienet0-serve ) > "$RT/log/oh-build.log" 2>&1 || { echo "BUILD_FAIL open-humanity (see $RT/log/oh-build.log)"; exit 60; } |
| 41 | cp "$RT/src/open-humanity/target/release/aienet0-run" "$RT/src/open-humanity/target/release/aienet0-serve" "$RT/bin/" |
| 42 | fi |
| 43 | OH_HEAD=$(git -C "$RT/src/open-humanity" rev-parse HEAD) |
| 44 | case $OH_HEAD in "$OH_PIN"*) ;; *) echo "NOT_RUN: open-humanity HEAD $OH_HEAD is not $OH_PIN"; exit 3;; esac |
| 45 | |
| 46 | if [ ! -x "$RT/bin/matmul_u32_recompute" ]; then |
| 47 | [ -f "$OMC_PINNED" ] || { echo "NOT_RUN: pinned omc missing at $OMC_PINNED"; exit 3; } |
| 48 | [ "$(sha "$OMC_PINNED")" = "$OMC_PIN" ] || { echo "NOT_RUN: $OMC_PINNED is not omc $OMC_PIN"; exit 3; } |
| 49 | cp "$OMC_PINNED" "$RT/bin/omc-2c824805" |
| 50 | chmod +x "$RT/bin/omc-2c824805" |
| 51 | [ -d "$RT/src/aien-protocols/.git" ] || git clone -q "$PROTO_REPO" "$RT/src/aien-protocols" |
| 52 | git -C "$RT/src/aien-protocols" checkout -q "$PROTO_PIN" |
| 53 | mkdir -p "$RT/src/omega-mv-55845e70/om/sha256" |
| 54 | git --git-dir="$OMEGA_MV_GIT/.git" show "$SHA_UNIT_COMMIT:om/sha256/sha256-om2.om" \ |
| 55 | > "$RT/src/omega-mv-55845e70/om/sha256/sha256-om2.om" || { echo "NOT_RUN: $OMEGA_MV_GIT lacks omega-mv $SHA_UNIT_COMMIT"; exit 3; } |
| 56 | OMEGA_OMC="$RT/bin/omc-2c824805" OMEGA_MV="$RT/src/omega-mv-55845e70" \ |
| 57 | $HEAVY sh "$RT/src/aien-protocols/specs/aienet/jobpath/build.sh" "$RT/bin/matmul_u32_recompute" \ |
| 58 | > "$RT/log/recompute-build.log" 2>&1 || { cat "$RT/log/recompute-build.log"; echo "BUILD_FAIL recompute"; exit 60; } |
| 59 | fi |
| 60 | [ "$(sha "$RT/bin/matmul_u32_recompute")" = "$RECOMPUTE_PIN" ] || { echo "NOT_RUN: recompute sha $(sha "$RT/bin/matmul_u32_recompute") is not $RECOMPUTE_PIN"; exit 3; } |
| 61 | |
| 62 | if [ ! -f "$RT/pins/executor.p256" ]; then |
| 63 | umask 077 |
| 64 | mkdir -p "$RT/keys" "$RT/wkeys" "$RT/pins" "$RT/wpins" |
| 65 | for f in keys/transport.seed keys/submitter.p256 keys/verifier.p256 wkeys/transport.seed wkeys/executor.p256; do |
| 66 | [ -f "$RT/$f" ] || openssl rand -hex -out "$RT/$f" 32 |
| 67 | done |
| 68 | "$RT/bin/aienet0-run" keys --keys "$RT/keys" > "$RT/coordinator-public-keys.txt" |
| 69 | "$RT/bin/aienet0-serve" keys --keys "$RT/wkeys" > "$RT/worker-public-keys.txt" |
| 70 | awk '$1=="coordinator.ed25519"{print $2 > "'"$RT/wpins/coordinator.ed25519"'"} |
| 71 | $1=="submitter.p256"{print $2 > "'"$RT/wpins/submitter.p256"'"}' "$RT/coordinator-public-keys.txt" |
| 72 | awk '$1=="volunteer.ed25519"{print $2 > "'"$RT/pins/volunteer.ed25519"'"} |
| 73 | $1=="executor.p256"{print $2 > "'"$RT/pins/executor.p256"'"}' "$RT/worker-public-keys.txt" |
| 74 | fi |
| 75 | |
| 76 | cat > "$RT/pins.env" <<EOF |
| 77 | AN0_RUN=$RT/bin/aienet0-run |
| 78 | AN0_SERVE=$RT/bin/aienet0-serve |
| 79 | AN0_RUN_SHA256=$(sha "$RT/bin/aienet0-run") |
| 80 | AN0_SERVE_SHA256=$(sha "$RT/bin/aienet0-serve") |
| 81 | OH_COMMIT=$OH_HEAD |
| 82 | PROTO_COMMIT=$(git -C "$RT/src/aien-protocols" rev-parse HEAD 2>/dev/null || echo NOT_BUILT_HERE) |
| 83 | RECOMPUTE=$RT/bin/matmul_u32_recompute |
| 84 | RECOMPUTE_SHA256=$RECOMPUTE_PIN |
| 85 | RECOMPUTE_OMC_SHA256=$OMC_PIN |
| 86 | SHA_UNIT_COMMIT=$SHA_UNIT_COMMIT |
| 87 | KEYS=$RT/keys |
| 88 | PINS=$RT/pins |
| 89 | WKEYS=$RT/wkeys |
| 90 | WPINS=$RT/wpins |
| 91 | RUSTC='$(rustc --version)' |
| 92 | EOF |
| 93 | cat "$RT/pins.env" |
| 94 | echo "RUNTIME_READY $RT" |