single-copy A/B: harness copy, STOP file, window script
This commit is contained in:
@@ -46,7 +46,7 @@ mkdir -p "$OUTR" "$STAMPS"; chmod 700 "$STAMPS"
|
||||
export LD_LIBRARY_PATH=$HOME/cuda-toolkits/cublas-12.9.1.4/lib:$HOME/cuda-toolkits/13.2.2/lib64:${LD_LIBRARY_PATH:-}
|
||||
|
||||
# ---- guards -------------------------------------------------------------------------------------------------------------------
|
||||
for f in "$UP" "$D/tools/long-session.py" "$D/scripts/e2e/run-e2e.sh" "$BIN_NEW/leleka" "$BIN_NEW/leleka-inference" "$BIN_NEW/leleka-daemon" "$BIN_NEW/leleka-cli" "$BIN_NEW/strata-next" \
|
||||
for f in "$UP" "$D/tools/long-session.py" "$SC/tools/run-e2e.sh" "$BIN_NEW/leleka" "$BIN_NEW/leleka-inference" "$BIN_NEW/leleka-daemon" "$BIN_NEW/leleka-cli" "$BIN_NEW/strata-next" \
|
||||
"$BIN_BASE/leleka-inference" "$BIN_BASE/leleka-daemon" "$BIN_BASE/leleka-cli" "$BIN_BASE/strata-next" "$KAR" "$SHARD0" "$SHARD1" "$CORPUS/backend-api/src/lib.rs" "$INV"; do
|
||||
[ -r "$f" ] || { echo "missing $f" >&2; exit 3; }
|
||||
done
|
||||
@@ -184,10 +184,10 @@ e2e_run() { # $1 tag $2 arm
|
||||
t0=$(date +%s.%N); echo "t0=$t0" >> "$E2E_OUT/env-arm.txt"
|
||||
runner() { while IFS= read -r l; do printf "%s %s\n" "$(date +%s.%N)" "$l"; done; }
|
||||
if [ "$arm" = file ]; then
|
||||
bash "$D/scripts/e2e/run-e2e.sh" 2>&1 | runner > "$E2E_OUT/job.log"
|
||||
bash "$SC/tools/run-e2e.sh" 2>&1 | runner > "$E2E_OUT/job.log"
|
||||
else
|
||||
flag=""; [ "$arm" = sparse ] && flag="--sparse-ple"
|
||||
"$BIN_NEW/leleka" seal-exec --file "$KAR" --expect-bytes $KAR_BYTES $flag -- bash -c 'LELEKA_STRA169_KAR_FD={FD} exec bash "$0"' "$D/scripts/e2e/run-e2e.sh" 2>&1 | runner > "$E2E_OUT/job.log"
|
||||
"$BIN_NEW/leleka" seal-exec --file "$KAR" --expect-bytes $KAR_BYTES $flag -- bash -c 'LELEKA_STRA169_KAR_FD={FD} exec bash "$0"' "$SC/tools/run-e2e.sh" 2>&1 | runner > "$E2E_OUT/job.log"
|
||||
fi
|
||||
kill $SAMP 2>/dev/null
|
||||
grep -a -E "^[0-9.]+ (\{|.*(expert cache|prefix cache budget|ready after|refus|rror|client exit|leleka-kar-startup))" "$E2E_OUT/job.log" | cut -c1-300 | tail -12
|
||||
@@ -252,6 +252,7 @@ if [[ " $PHASES " == *" e2e "* ]]; then
|
||||
ord=(${orders[$(( (b - 1) % 6 ))]})
|
||||
for idx in "${ord[@]}"; do
|
||||
[ "$idx" -lt "$narms" ] || continue
|
||||
if [ -e "$SC/STOP" ]; then echo "STOP file present: ending the A/B early so that the queue can use the GPU"; break 2; fi
|
||||
arm=${arms[$idx]}; n=$((n + 1)); tag="b$(printf %02d "$b")-$arm$RUN_TAG"
|
||||
e2e_run "$tag" "$arm" || continue
|
||||
validity "$OUTR/$tag" "$arm"
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# A holder-free window for single-copy-ab.sh, started DETACHED by a holder job stub (the stub touches jobs/STOP, closes the holder's descriptor and launches this).
|
||||
# single-copy-window.sh LABEL environment (PHASES, BLOCKS, ARMS_SET, RUN_TAG, OUTR) is passed through to single-copy-ab.sh
|
||||
# 1. waits until the holder process has ended and its 51.5 GiB memfd is gone (the holder ends after the stub returns because jobs/STOP exists);
|
||||
# 2. runs single-copy-ab.sh (it takes MODEL.lock and gpu.lock itself);
|
||||
# 3. ALWAYS restarts the lab holder afterwards, with the fast seal (single-copy-holder.sh: O_DIRECT, no page cache), so the queue goes on.
|
||||
# The A/B ends early (between runs) when /data/leleka-e2e/single-copy/STOP exists.
|
||||
set -u
|
||||
LABEL=${1:-window}
|
||||
SC=/data/leleka-e2e/single-copy
|
||||
H=$HOME/work/gpu-runs/holder2
|
||||
NOTES=/data/leleka-e2e/decode/notes.md
|
||||
note() { echo "[$(date -u +%FT%TZ)] [DEV single-copy] $*" >> "$NOTES"; }
|
||||
restart_holder() {
|
||||
if pgrep -u "$USER" -f 'kar_holder2?\.py|single-copy-holder\.py' >/dev/null; then echo "a holder is already running"; return; fi
|
||||
rmdir "$HOME/work/gpu-runs/MODEL.lock" 2>/dev/null # ours, if the A/B died holding it
|
||||
rm -f "$H/jobs/STOP" "$H/jobs/READY"
|
||||
( cd "$H" && setsid nohup bash "$SC/tools/single-copy-holder.sh" > "$H/holder3.out" 2>&1 < /dev/null & )
|
||||
note "window $LABEL over: holder restarted with the fast seal (holder3.out); queue open again"
|
||||
}
|
||||
trap restart_holder EXIT
|
||||
note "window $LABEL: waiting for the holder to end (jobs/STOP is set), then single-copy-ab.sh PHASES='${PHASES:-cold id e2e}' BLOCKS=${BLOCKS:-6}"
|
||||
for _ in $(seq 1 240); do
|
||||
if ! pgrep -u "$USER" -f 'kar_holder2?\.py|single-copy-holder\.py' >/dev/null && [ ! -d "$HOME/work/gpu-runs/MODEL.lock" ]; then break; fi
|
||||
sleep 5
|
||||
done
|
||||
if pgrep -u "$USER" -f 'kar_holder2?\.py|single-copy-holder\.py' >/dev/null; then note "window $LABEL: the holder did not end in 20 min, giving up (holder left as it is)"; trap - EXIT; exit 3; fi
|
||||
# the holder's 51.5 GiB must really be gone
|
||||
sleep 5
|
||||
note "window $LABEL: holder gone, MemAvailable $(awk '/^MemAvailable:/{printf "%d GiB", $2/1048576}' /proc/meminfo); starting"
|
||||
bash "$SC/tools/single-copy-ab.sh" > "$SC/window-$LABEL.out" 2>&1
|
||||
note "window $LABEL: single-copy-ab.sh ended rc=$?; outputs under ${OUTR:-/data/leleka-e2e/runs/single-copy-ab}, log $SC/window-$LABEL.out"
|
||||
Reference in New Issue
Block a user