prove-shard.sh: mode shard on block-338-shard1 (execute, core, compressed), then mode block on block-341-shards2 and block-344-shards4 (compressed proof per shard, aggregation), RESULT lines with timestamps, log uploaded after each stage. PROVE-BLOCK.bat keeps the small block (mode all; the CPU comparison is mode shard now). make-package.sh packs the aggregator crate and the simnet export too; README rewritten for the shard run. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
63 lines
3.5 KiB
Bash
Executable file
63 lines
3.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Igneum proving: proves one fixture block inside WSL2, GPU first (SP1_PROVER=cuda, mode all: shard 0 in all three
|
|
# stages, then the block end to end) then CPU for comparison, prints the RESULT lines and uploads the log to the
|
|
# Igneum log intake. Run by PROVE-BLOCK.bat. For the shard fixtures at S_p use prove-shard.sh.
|
|
# Usage: prove-block.sh [fixture name without .json, default block-78-increment] [cpu mode, default shard]
|
|
set -uo pipefail
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
FIXTURE="${1:-block-78-increment}"
|
|
CPU_MODES="${2:-shard}"
|
|
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:-}"
|
|
DEST="$HOME/igneum-prove"
|
|
STAMP="$(date -u +%Y%m%d-%H%M%S)"
|
|
LOG="$HERE/prove-$FIXTURE-$STAMP.log"
|
|
RUN_ID="prove-$(hostname)-$STAMP"
|
|
exec > >(tee -a "$LOG") 2>&1
|
|
echo "igneum proving v0, run $RUN_ID, $(date -u +%FT%TZ), host $(hostname), fixture $FIXTURE"
|
|
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader 2>/dev/null || echo "nvidia-smi not available in WSL"
|
|
echo "cpu: $(nproc) cores, ram: $(free -g | awk '/Mem:/ {print $2}') GB visible to WSL"
|
|
|
|
upload() {
|
|
# Last 256 KB of the log to the intake, same URL and key as upload-log.bat (log uploads only).
|
|
python3 - "$LOG" "$RUN_ID" <<'PY'
|
|
import json, socket, sys, urllib.request
|
|
path, run_id = sys.argv[1], sys.argv[2]
|
|
data = open(path, 'rb').read()[-262144:].decode('utf-8', 'replace')
|
|
body = json.dumps({"label": "prove-" + socket.gethostname(), "machine": socket.gethostname(), "run_id": run_id, "lines": data}).encode()
|
|
req = urllib.request.Request("https://igneum-six.vercel.app/api/log", data=body, headers={"Content-Type": "application/json", "x-igneum-key": "***INTAKE-KEY-REMOVED***"})
|
|
try:
|
|
with urllib.request.urlopen(req, timeout=60) as r:
|
|
print("upload:", r.status, r.read()[:200].decode('utf-8', 'replace'))
|
|
except Exception as e:
|
|
print("upload failed:", e)
|
|
PY
|
|
}
|
|
|
|
# Fresh sources from the package (edits on the Windows side are picked up), build with the cuda feature.
|
|
mkdir -p "$DEST"
|
|
rsync -a --delete --exclude target "$HERE/package/" "$DEST/" 2>/dev/null || cp -r "$HERE/package/." "$DEST/"
|
|
cd "$DEST/proving/igneum-prove"
|
|
echo "building (first time: 10 to 30 minutes, approximate; both guests are compiled by cargo-prove inside the host build)"
|
|
if ! cargo build --release -p igneum-prove-host --features igneum-prove-host/cuda 2>&1 | tail -3; then
|
|
echo "BUILD FAILED"; upload; exit 1
|
|
fi
|
|
HOST="$DEST/proving/igneum-prove/target/release/igneum-prove-host"
|
|
FIX="$DEST/proving/fixtures/$FIXTURE.json"
|
|
mkdir -p "$HERE/results"
|
|
|
|
|
|
echo "=== GPU run: SP1_PROVER=cuda, mode all (shard 0: execute + core + compressed; then the block: shard proofs + aggregation); the first run downloads sp1-gpu-server, about 134 MB ==="
|
|
SP1_PROVER=cuda RUST_LOG=info "$HOST" "$FIX" --mode all --out "$HERE/results/$FIXTURE-cuda-$STAMP.json"
|
|
echo "gpu run exit $?"
|
|
upload
|
|
|
|
echo "=== CPU run: SP1_PROVER=cpu, mode $CPU_MODES (for comparison; a shard on the CPU can take many minutes) ==="
|
|
SP1_PROVER=cpu RUST_LOG=info "$HOST" "$FIX" --mode "$CPU_MODES" --out "$HERE/results/$FIXTURE-cpu-$STAMP.json"
|
|
echo "cpu run exit $?"
|
|
|
|
echo "=== SUMMARY (RESULT lines) ==="
|
|
grep -h '^RESULT\|^fixture\|exit' "$LOG" | sed 's/^/ /'
|
|
upload
|
|
echo "log: $LOG (uploaded as run_id $RUN_ID; on the Mac: node tools/logs.mjs $RUN_ID)"
|