diff --git a/bench/proof-systems/run.sh b/bench/proof-systems/run.sh index c2b737783..2bc93afd0 100755 --- a/bench/proof-systems/run.sh +++ b/bench/proof-systems/run.sh @@ -7,10 +7,10 @@ HERE="$(cd "$(dirname "$0")" && pwd)"; ROOT="$(cd "$HERE/../.." && pwd)" CANDS="sp1,r0"; BACKEND=""; FIXTURE="$ROOT/proving/fixtures/fees-v1-shards2.json"; SHARD=0; LABEL=""; OUT="$HERE/rows" SP1_HOST="$ROOT/proving/igneum-prove/target/release/igneum-prove-host" R0_HOST="$ROOT/proving/igneum-prove-r0/target/release/igneum-prove-r0-host" -PATCHED_HOME="/opt/igneum-floor/home" +PATCHED_HOME="/opt/igneum-floor/home"; PATCHED_ENV="" # --label: a note on the row ("beside the miner", "alone"); --sp1-host/--r0-host/--out: paths on a machine where the # tree is not checked out (PC 2's WSL: /opt/igneum-segal/igneum-prove-host); --patched-home: the patched server's HOME -while [ $# -gt 0 ]; do case "$1" in --candidates) CANDS="$2"; shift 2;; --backend) BACKEND="$2"; shift 2;; --fixture) FIXTURE="$2"; shift 2;; --shard) SHARD="$2"; shift 2;; --label) LABEL="$2"; shift 2;; --sp1-host) SP1_HOST="$2"; shift 2;; --r0-host) R0_HOST="$2"; shift 2;; --out) OUT="$2"; shift 2;; --patched-home) PATCHED_HOME="$2"; shift 2;; *) echo "unknown $1"; exit 2;; esac; done +while [ $# -gt 0 ]; do case "$1" in --candidates) CANDS="$2"; shift 2;; --backend) BACKEND="$2"; shift 2;; --fixture) FIXTURE="$2"; shift 2;; --shard) SHARD="$2"; shift 2;; --label) LABEL="$2"; shift 2;; --sp1-host) SP1_HOST="$2"; shift 2;; --r0-host) R0_HOST="$2"; shift 2;; --out) OUT="$2"; shift 2;; --patched-home) PATCHED_HOME="$2"; shift 2;; --patched-env) PATCHED_ENV="$2"; shift 2;; *) echo "unknown $1"; exit 2;; esac; done MACHINE="$(hostname -s)"; DATE="$(date -u +%Y%m%d-%H%M)"; mkdir -p "$OUT" if [ -z "$BACKEND" ]; then if command -v nvidia-smi >/dev/null 2>&1; then BACKEND=cuda; elif [ "$(uname)" = Darwin ]; then BACKEND=metal; else BACKEND=cpu; fi; fi # the time tool: the Mac's /usr/bin/time -l prints "maximum resident set size" in bytes, GNU time -v in KB @@ -51,7 +51,7 @@ PY for c in ${CANDS//,/ }; do case "$c" in sp1) if [ "$BACKEND" = cuda ]; then row sp1 cuda "$SP1_HOST" "SP1_PROVER=cuda RUST_LOG=off"; else row sp1 cpu "$SP1_HOST" "SP1_PROVER=cpu RUST_LOG=off"; fi ;; - sp1-patched) if [ "$BACKEND" = cuda ] && [ -d "$PATCHED_HOME" ]; then row sp1-patched cuda "$SP1_HOST" "HOME=$PATCHED_HOME SP1_PROVER=cuda RUST_LOG=off"; else printf '{"candidate":"sp1-patched","machine":"%s","backend":"%s","na":"the patched server exists only on PC 2 (/opt/igneum-floor/home)","date":"%s"}\n' "$MACHINE" "$BACKEND" "$DATE" > "$OUT/$DATE-$MACHINE-sp1-patched.json"; echo "row sp1-patched: n/a"; fi ;; + sp1-patched) if [ "$BACKEND" = cuda ] && [ -d "$PATCHED_HOME" ]; then row sp1-patched cuda "$SP1_HOST" "HOME=$PATCHED_HOME SP1_PROVER=cuda RUST_LOG=off $PATCHED_ENV"; else printf '{"candidate":"sp1-patched","machine":"%s","backend":"%s","na":"the patched server exists only on PC 2 (/opt/igneum-floor/home)","date":"%s"}\n' "$MACHINE" "$BACKEND" "$DATE" > "$OUT/$DATE-$MACHINE-sp1-patched.json"; echo "row sp1-patched: n/a"; fi ;; r0) if [ "$BACKEND" = cuda ]; then row r0 cuda "$R0_HOST" "RISC0_PROVER=local RUST_LOG=off"; elif [ "$BACKEND" = metal ]; then row r0 metal "$R0_HOST" "RISC0_PROVER=local RUST_LOG=off"; else row r0 cpu "$R0_HOST" "RISC0_PROVER=local RUST_LOG=off"; fi ;; jolt) printf '{"candidate":"jolt","machine":"%s","backend":"%s","na":"no guest for our shard statement and no shipped recursion (proving-methods.md route F)","date":"%s"}\n' "$MACHINE" "$BACKEND" "$DATE" > "$OUT/$DATE-$MACHINE-jolt.json"; echo "row jolt: n/a" ;; *) echo "unknown candidate $c" ;; diff --git a/tools/proving-v1/pc2-bench-a.ps1 b/tools/proving-v1/pc2-bench-a.ps1 new file mode 100644 index 000000000..bba4d5464 --- /dev/null +++ b/tools/proving-v1/pc2-bench-a.ps1 @@ -0,0 +1,51 @@ +# Proof-system bench job A on PC 2 (6 October 2026, the project lead's proof-system plan step 3): the v1 shard and the empty shard +# on SP1 stock (the /opt/igneum-segal host, CUDA) and on the prover-floor agent's patched server (HOME=/opt/igneum-floor/home, +# the default profile and the 2^26 profile), beside the app's miner. A signed `run` job, not elevated; the app's own +# prover OFF for the run and ON at the end; the app never quit; sockets cleaned around the root runs. Rows: the kit's +# bench/proof-systems/run.sh (fetched to prove\bench-ps), one JSON per row, printed at the end as ROW lines. +$ErrorActionPreference = 'Continue' +function Stamp { (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') } +$app = if ($env:IGNEUM_APP_DIR) { $env:IGNEUM_APP_DIR } else { Join-Path $env:LOCALAPPDATA 'igneum\app' } +$base = (Get-Content (Join-Path $app 'app.url') -Raw).Trim().TrimEnd('/') +function Post($path, $obj) { try { (Invoke-RestMethod -Method Post -Uri "$base$path" -ContentType 'application/json' -Body ($obj | ConvertTo-Json -Compress) -TimeoutSec 10) | ConvertTo-Json -Compress } catch { "error: $_" } } +$job = $env:IGNEUM_JOB_DIR; if (-not $job) { $job = Join-Path $env:TEMP 'igneum-bench-a' } +New-Item -ItemType Directory -Force -Path $job | Out-Null +"RESULT start $(Stamp) job=$job" +$kit = Join-Path $env:LOCALAPPDATA 'igneum\prove\bench-ps\bench-ps' +if (-not (Test-Path (Join-Path $kit 'run.sh'))) { $kit = Join-Path $env:LOCALAPPDATA 'igneum\prove\bench-ps' } +"RESULT kit $(Stamp) $kit exists=$(Test-Path (Join-Path $kit 'run.sh'))" +if (-not (Test-Path (Join-Path $kit 'run.sh'))) { "RESULT refused $(Stamp) kit missing"; exit 1 } +"RESULT prove_off $(Stamp) $(Post '/api/prove' @{on=$false})" +Start-Sleep -Seconds 5 +function WslPath($p) { $w = (& wsl.exe -d Ubuntu-24.04 -u root -- wslpath -a ($p -replace '\\', '/') 2>$null); if ($w) { ($w -replace "`0", '').Trim() } else { '/mnt/c' + ($p.Substring(2) -replace '\\', '/') } } +$kitW = WslPath $kit; $jobW = WslPath $job +$bash = @' +set -uo pipefail +export PATH="$HOME/.cargo/bin:$HOME/.sp1/bin:$PATH" +CUDA_DIR="$(ls -d /usr/local/cuda-12.* 2>/dev/null | sort -V | tail -1 || true)"; [ -n "$CUDA_DIR" ] && export PATH="$CUDA_DIR/bin:$PATH" && export LD_LIBRARY_PATH="$CUDA_DIR/lib64:/usr/lib/wsl/lib:${LD_LIBRARY_PATH:-}" +stamp() { date -u +%Y-%m-%dT%H:%M:%SZ; } +KIT="$1"; JOB="$2" +# the root-socket rule: kill and unlink around every root run (the app's prover is off for the run) +pkill -f sp1-gpu-server; sleep 1; rm -f /tmp/sp1-cuda-*.sock +echo "RESULT socket_start $(stamp) servers=$(pgrep -x sp1-gpu-server | wc -l) sockets=$(ls /tmp/sp1-cuda-*.sock 2>/dev/null | wc -l)" +H=/opt/igneum-segal/igneum-prove-host; [ -x "$H" ] || H=/opt/igneum/igneum-prove-host +echo "RESULT host $(stamp) $H $(sha256sum $H | cut -c1-16); patched home: $(ls /opt/igneum-floor/home/.sp1/bin 2>/dev/null | tr '\n' ' ')" +mkdir -p "$JOB/rows"; cp "$KIT/run.sh" "$JOB/run.sh"; chmod +x "$JOB/run.sh" +for fx in fees-v1-shards2.json block-338-shard1.json; do + echo "RESULT fixture $(stamp) $fx stock" + bash "$JOB/run.sh" --candidates sp1 --backend cuda --sp1-host "$H" --fixture "$KIT/$fx" --shard 0 --label "beside the miner" --out "$JOB/rows" 2>&1 | sed 's/^/stock: /' + pkill -f sp1-gpu-server; sleep 1; rm -f /tmp/sp1-cuda-*.sock + echo "RESULT fixture $(stamp) $fx patched default" + bash "$JOB/run.sh" --candidates sp1-patched --backend cuda --sp1-host "$H" --fixture "$KIT/$fx" --shard 0 --label "beside the miner, patched default" --out "$JOB/rows" 2>&1 | sed 's/^/patched: /' + pkill -f sp1-gpu-server; sleep 1; rm -f /tmp/sp1-cuda-*.sock + echo "RESULT fixture $(stamp) $fx patched 2^26" + bash "$JOB/run.sh" --candidates sp1-patched --backend cuda --sp1-host "$H" --fixture "$KIT/$fx" --shard 0 --label "beside the miner, patched 2^26" --patched-env "SP1_GPU_ELEMENT_THRESHOLD=67108864" --out "$JOB/rows" 2>&1 | sed 's/^/patched26: /' + pkill -f sp1-gpu-server; sleep 1; rm -f /tmp/sp1-cuda-*.sock +done +for f in "$JOB"/rows/*.json; do echo "ROW $(basename "$f") $(tr -d '\n' < "$f")"; done +echo "RESULT socket_cleanup $(stamp) servers=$(pgrep -x sp1-gpu-server | wc -l) sockets=$(ls /tmp/sp1-cuda-*.sock 2>/dev/null | wc -l)" +'@ +[IO.File]::WriteAllText((Join-Path $job 'bench.sh'), ($bash -replace "`r`n", "`n"), (New-Object System.Text.UTF8Encoding $false)) +& wsl.exe -d Ubuntu-24.04 -u root -- bash "$jobW/bench.sh" $kitW $jobW 2>&1 | ForEach-Object { ($_ -replace "`0", '') } +"RESULT prove_on $(Stamp) $(Post '/api/prove' @{on=$true})" +"RESULT end $(Stamp)"