kolinfluence's picture
publish runsplit.sh (engine e265bbf)
7dd6ae5 verified
Raw History Blame Contribute Delete
1.35 kB
#!/usr/bin/env bash
# ON THE BOX. One engine arm at a FIXED prompt length, prefill and decode split
# into separate timed processes, each sampled by phase.py from outside.
# usage: runsplit.sh <binary> <threads> <chunk> <prompt> <decode_tokens> <outdir>
set -u
BIN=${1:?}; T=${2:?}; C=${3:?}; N=${4:?}; D=${5:?}; OUT=${6:?}
GGUF=/home/ubuntu/kat-coder-i-compact.gguf
mkdir -p "$OUT"
export OAICA_LICENSE_DEV_BYPASS=1
run_phase() { # $1=name, rest = bench args
local name=$1; shift
$BIN "$GGUF" "$@" --threads "$T" >"$OUT/stderr_$name.log" 2>&1 &
local pid=$!
# a fast process would exit before phase.py's first sample: run the
# profiled copy so the sampler always attaches, then fall back to plain.
python3 /home/ubuntu/phase.py --procname cpu_par_bench --out "$OUT/$name" --interval 0.02 \
--max-secs 3600 >"$OUT/$name.summary.txt" 2>"$OUT/$name.attach.log" &
local sp=$!
wait $pid; local rc=$?
wait $sp
echo "$name rc=$rc at=$(date -Is)"
}
# prefill arm: prompt N, decode 0 tokens (no DECODE line, no LM-head loop)
run_phase prefill_$N --decode 0 --prefill "$N" --chunk "$C"
# decode arm: prompt N (not timed in the summary) then D decode tokens
run_phase decode_$N --decode "$D" --prefill "$N" --chunk "$C"
grep -h "PREFILL threads" "$OUT"/stderr_prefill_$N.log
grep -h "DECODE threads" "$OUT"/stderr_decode_$N.log