interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / om / sha256 / om2-evidence / baseline-acb3f15c / run-baseline.sh

29 lines · 2485 bytes Raw Blame History
1#!/bin/sh
2# L838 baseline: the historical SHA-256 measurement at omega main acb3f15c, reproduced with the
3# historical harnesses om/sha256/parity/bench.c and small.c, unmodified. Both arms (Omega = src/sha256.c
4# + src/omega_om_units.inc; C = src/sha256.c of a647b6a9, symbols renamed exactly as parity/run.sh does)
5# are compiled with identical flags and run in one process, pinned to one Cortex-X925 core.
6# small.c: per length, 11 interleaved rounds of (C batch, Omega batch), 200,000 calls each.
7# bench.c: 64 MiB bulk (C then Omega) and 200,000 x 32-byte sha256_hash (Omega then C); run 11 times.
8set -eu
9REPO=${REPO:-/tmp/zl/main}
10CPU=${CPU:-19}
11FLAGS="-std=gnu11 -O2"
12T=/tmp/zl/sha-base/build; rm -rf "$T"; mkdir -p "$T"
13[ "$(git -C "$REPO" rev-parse HEAD)" = acb3f15cdc691b1b046b48b0dad0f9255a12ba4b ]
14git -C "$REPO" status --porcelain -- src om | grep . && { echo "dirty baseline"; exit 1; } || true
15git -C "$REPO" show a647b6a9821fffcf52ba9ce813f75afa4b84be62:src/sha256.c > "$T/c.c"
16[ "$(/usr/bin/sha256sum < "$T/c.c" | cut -c1-64)" = a8fb88611e68ea5a876ee1658e1665994a03bfbed215983618d769f0e7205473 ]
17sed 's/sha256_\(init\|update\|final\|hash\|transform\)/orc_sha256_\1/g; s/^static const uint32_t K\b/static const uint32_t ORC_K/; s/\bK\[/ORC_K[/g' "$T/c.c" > "$T/oracle.c"
18cc $FLAGS -I"$REPO/src" -c "$REPO/src/sha256.c" -o "$T/new.o"
19cc $FLAGS -I"$REPO/src" -c "$T/oracle.c" -o "$T/oracle.o"
20cc $FLAGS -I"$REPO/src" "$REPO/om/sha256/parity/bench.c" "$T/new.o" "$T/oracle.o" -o "$T/bench" -pthread
21cc $FLAGS -I"$REPO/src" "$REPO/om/sha256/parity/small.c" "$T/new.o" "$T/oracle.o" -o "$T/small" -pthread
22echo "# baseline acb3f15c $(date -u +%FT%TZ) host $(uname -nrm) cpu$CPU midr $(cat /sys/devices/system/cpu/cpu$CPU/regs/identification/midr_el1) max_khz $(cat /sys/devices/system/cpu/cpu$CPU/cpufreq/cpuinfo_max_freq)"
23echo "# cc: $(cc --version | head -1); flags: $FLAGS (both arms)"
24echo "# sha256: src/sha256.c $(/usr/bin/sha256sum < "$REPO/src/sha256.c" | cut -c1-16) omega_om_units.inc $(/usr/bin/sha256sum < "$REPO/src/omega_om_units.inc" | cut -c1-16) oracle a8fb8861 bench.c $(/usr/bin/sha256sum < "$REPO/om/sha256/parity/bench.c" | cut -c1-16) small.c $(/usr/bin/sha256sum < "$REPO/om/sha256/parity/small.c" | cut -c1-16)"
25echo "# loadavg before: $(cat /proc/loadavg)"
26for r in 1 2 3 4 5 6 7 8 9 10 11; do echo "bench run $r"; taskset -c "$CPU" "$T/bench"; done
27echo "small"
28taskset -c "$CPU" "$T/small"
29echo "# loadavg after: $(cat /proc/loadavg)"