Files
esh-pfi-infrastructure/scripts/oneoff/fv-ml1-gpucheck.sh
T
vh c35f6510bf feat(fv-ml1): rebalance GPUs 0/1 by usage; contexts to published maximums; gen-small default output cap
Layout: GPU 0 = cyberprev (KV 16 -> 15 GiB, 1.29x), erp-seat (moved from
GPU 1, KV 8.49 -> 5.5 GiB, 1.32x), voices (ctx 8,192 -> 40,960, its native
maximum, KV 6 GiB, 1.07x), coder (moved from GPU 1, ctx 16,384 -> 32,768,
the card maximum, 2.35x), parakeet-nemo. GPU 1 = gen-small (moved from
GPU 0, 5.5 GiB, 1.76x), meromero-rp (22 GiB, 1.32x), intern-decision.

Sizing rule: KV >= 1.25x max context rounded up to 0.5 GiB, checked against
7 days of LiteLLM traffic and the engines' own KV-usage logs. Each card keeps
spare memory for its bursty tenant (parakeet's cap on GPU 0, intern-decision's
32k call on GPU 1). YaRN extensions are not enabled: they do not fit, and the
Qwen cards warn static YaRN degrades short prompts.

gen-small gets --override-generation-config max_new_tokens 32768. It applies
only to requests that omit max_tokens (vLLM get_max_tokens) and answers 9
runaway ~260k-token replies in 7 days; the longest normal reply was 6,357.

Applied with playbooks/fv-ml1-rebalance-20261005.yaml (boot-check guard and
health/KV verification per seat); all nine seats healthy, gateway smoke
tests pass.
2026-10-05 22:51:17 -07:00

26 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# fv-ml1-gpucheck.sh — the vLLM boot-check arithmetic, run before (re)creating a seat.
#
# fv-ml1-gpucheck.sh <gpu-index> <util> [container]
#
# vLLM refuses to start unless the card's free memory >= util x total (97,249 MiB on these
# cards). Passes when nvidia-smi Free on <gpu-index>, plus <container>'s own memory ON THAT
# CARD (it is freed when the container is recreated), clears util x 97,249 + 512 MiB.
# A container that is moving here from another card counts nothing, so leave it off.
# Uploaded and run by playbooks/fv-ml1-rebalance-20261005.yaml.
set -u
gpu=$1 util=$2 own_c=${3:-}
free=$(nvidia-smi -i "$gpu" --query-gpu=memory.free --format=csv,noheader,nounits)
own=0
if [ -n "$own_c" ]; then
uuid=$(nvidia-smi -i "$gpu" --query-gpu=uuid --format=csv,noheader)
apps=$(nvidia-smi --query-compute-apps=pid,gpu_uuid,used_memory --format=csv,noheader,nounits)
for p in $(docker top "$own_c" -eo pid 2>/dev/null | tail -n +2); do
m=$(printf '%s\n' "$apps" | awk -F', ' -v p="$p" -v u="$uuid" '$1==p && $2==u {print $3}')
own=$((own + ${m:-0}))
done
fi
need=$(awk -v u="$util" 'BEGIN{printf "%d", u*97249+512}')
echo "GPU$gpu free=$free own=$own need=$need"
[ $((free + own)) -ge "$need" ]