Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
53 lines
4.1 KiB
Bash
53 lines
4.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Vanilla Strata 0.2.6 on the same recorded prompts as spd_replay_job.sh, with the verifier step profile on (STRATA_VERIFY_PROFILE=1), for the step-by-step comparison with the release
|
|
# (docs/experiments/codex-compare-speed-gap.md). Holder-free window payload (started by spd_window.sh). Test tooling, never in serving.
|
|
# SPD_LOSSY=0 (default) lossy defaults off (VANL); 1 = shipped defaults (VAN) SPD_MAX (requests per cell, default 30) SPD_CELLS SPD_RUN (result dir)
|
|
set -uo pipefail
|
|
SPD=/data/leleka-e2e/spd-gap
|
|
CMP=/data/leleka-e2e/codex-compare
|
|
A=/home/para/work/leleka/models/leleka-gates/assets
|
|
G=$HOME/work/gpu-runs
|
|
LOCK=/data/leleka-e2e/gpu.lock
|
|
LOSSY=${SPD_LOSSY:-0}
|
|
RUN=${SPD_RUN:-$SPD/runs/main/V$([ "$LOSSY" = 1 ] && echo AN || echo ANL)}
|
|
CELLS=${SPD_CELLS:-"$CMP/runs/main/VANL/nestng-crm-r2"}
|
|
MAXR=${SPD_MAX:-30}
|
|
mkdir -p "$RUN"
|
|
exec > >(tee -a "$RUN/job.log") 2>&1
|
|
log() { echo "[spd-van $(date -u +%T)] $*"; }
|
|
mkdir "$G/MODEL.lock" 2>/dev/null || { echo "MODEL.lock is held (holder still up?)"; exit 3; }
|
|
got=0; for _ in $(seq 1 4320); do if mkdir "$LOCK" 2>/dev/null; then echo "spd-gap vanilla $(date -u +%FT%TZ) $RUN" >"$LOCK/owner"; got=1; break; fi; sleep 5; done
|
|
[ $got = 1 ] || { echo "GPU lock held by: $(cat $LOCK/owner 2>/dev/null)"; rmdir "$G/MODEL.lock"; exit 3; }
|
|
S=$HOME/work/vanilla-strata/control/bin/strata
|
|
cleanup() { ( cd "$HOME/work/vanilla-strata/control" && "$S" launch --stop >/dev/null 2>&1 ); sleep 5; rm -f "$LOCK/owner"; rmdir "$LOCK" 2>/dev/null; rmdir "$G/MODEL.lock" 2>/dev/null; }
|
|
trap cleanup EXIT
|
|
[ -z "$(nvidia-smi --query-compute-apps=pid --format=csv,noheader 2>/dev/null)" ] || { echo "something uses the GPU"; exit 3; }
|
|
export XDG_CONFIG_HOME=$RUN/xdg-config XDG_STATE_HOME=$RUN/xdg-state
|
|
mkdir -p "$XDG_CONFIG_HOME/strata" "$XDG_STATE_HOME"; cp ~/.config/strata/settings.json "$XDG_CONFIG_HOME/strata/"
|
|
if [ "$LOSSY" = 1 ]; then unset STRATA_ROUTE_TAIL_SKIP STRATA_PREFILL_CPU_SHARE; else export STRATA_ROUTE_TAIL_SKIP=0 STRATA_PREFILL_CPU_SHARE=0; fi
|
|
if [ "${SPD_CUPTI:-0}" = 1 ]; then # a kernel window over one request of the replay: no engine-side profile (it costs vanilla about 20 % decode)
|
|
DRT=/data/leleka-e2e/draft-round; WIN_S=${SPD_WIN_S:-15}; TRIG_AT=${SPD_TRIG_AT:-28}
|
|
export CUDA_INJECTION64_PATH=$DRT/tools/libleleka_cupti_trace.so LELEKA_CUPTI_TRIGGER=$RUN/cupti.trigger LCT_MAX_SECONDS=60 LD_LIBRARY_PATH=$DRT/cupti/lib:${LD_LIBRARY_PATH:-}
|
|
else
|
|
export STRATA_VERIFY_PROFILE=1
|
|
export STRATA_DECODE_TIMING=1 # the serve path prints "strata decode GPU stages" only with it
|
|
fi
|
|
export LD_LIBRARY_PATH=$HOME/cuda-toolkits/cublas-12.9.1.4/lib:$HOME/cuda-toolkits/13.2.2/lib64:${LD_LIBRARY_PATH:-}
|
|
cd "$HOME/work/vanilla-strata/control"
|
|
t0=$(date +%s)
|
|
timeout 2400 "$S" launch --model iq3_s --family qwen --model-path "$A/model" --context 256k --kv int8 --vision off --parallel 1 --tune skip --access local --port 8090 --no-api-key --no-tui --yes >"$RUN/launch.out" 2>&1
|
|
log "launch rc=$? ready after $(( $(date +%s) - t0 )) s"
|
|
curl -fs http://127.0.0.1:8090/v1/models >"$RUN/models.json" || { log "vanilla did not become ready"; exit 4; }
|
|
MODEL=$(python3 -c "import json;print(json.load(open('$RUN/models.json'))['data'][0]['id'])")
|
|
args=(); for c in $CELLS; do args+=(--cell "$c"); done
|
|
if [ "${SPD_CUPTI:-0}" = 1 ]; then
|
|
( for _ in $(seq 1 30000); do n=$(wc -l <"$RUN/replay.jsonl" 2>/dev/null || echo 0); if [ "${n:-0}" -ge "$TRIG_AT" ]; then printf '{"seconds": %s, "out": "%s/win-r%s", "label": "r%s"}
|
|
' "$WIN_S" "$RUN" "$((n+1))" "$((n+1))" >"$RUN/cupti.trigger.tmp" && mv "$RUN/cupti.trigger.tmp" "$RUN/cupti.trigger"; break; fi; sleep 0.2; done ) &
|
|
WATCH_PID=$!
|
|
fi
|
|
python3 -I "$SPD/tools/replay_fwd.py" "${args[@]}" --url http://127.0.0.1:8090 --model "$MODEL" --out "$RUN/replay.jsonl" --max-requests "$MAXR" >"$RUN/replay.out" 2>&1
|
|
log "replay rc=$? $(wc -l <"$RUN/replay.jsonl") requests"
|
|
if [ "${SPD_CUPTI:-0}" = 1 ]; then for _ in $(seq 1 60); do [ -e "$RUN/cupti.trigger.done" ] && break; sleep 1; done; kill "$WATCH_PID" 2>/dev/null; fi
|
|
cp "$XDG_STATE_HOME/strata/launch/iq3_s-256k.engine.log" "$RUN/engine.log" 2>/dev/null
|
|
log "done"
|