bench: TP sweep harness (xserv --tp, llama row-split, concurrent groups)

runner/servers gain --tp (xserv --tp N; llama.cpp --split-mode row) and
--llama-devices so llama can run on a disjoint GPU group. run_tp_parallel.sh
runs xserv (GPU 0..N-1) and llama.cpp (GPU 4..4+N-1) concurrently per TP,
matching the box's 0-3 / 4-7 PHB groups. summarize_tp.py tabulates the sweep.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 11:10:43 +08:00
parent 95eb61d639
commit a4a171d425
4 changed files with 98 additions and 6 deletions

View File

@@ -113,14 +113,18 @@ def xserv_launch_cmd(
*,
max_batch: int,
max_seq_len: int,
tp: int = 1,
) -> list[str]:
return [
cmd = [
bin_path,
model_dir,
"--port", str(port),
"--max-batch", str(max_batch),
"--max-seq-len", str(max_seq_len),
]
if tp > 1:
cmd += ["--tp", str(tp)] # xserv binds rank r -> GPU r internally
return cmd
def llama_cpp_launch_cmd(
@@ -131,13 +135,14 @@ def llama_cpp_launch_cmd(
n_parallel: int,
ctx_per_slot: int,
n_gpu_layers: int = 99,
tp: int = 1,
) -> list[str]:
# llama.cpp DIVIDES total -c across --parallel slots: per-slot context is
# n_ctx / n_parallel. xserv gives each sequence the full max_seq_len, so to
# match we must set total -c = ctx_per_slot * n_parallel. Getting this wrong
# silently truncates long generations (e.g. AIME) on llama.cpp's side.
total_ctx = ctx_per_slot * n_parallel
return [
cmd = [
bin_path,
"-m", gguf_path,
"--port", str(port),
@@ -148,3 +153,9 @@ def llama_cpp_launch_cmd(
# NOTE: do NOT pass --log-disable; its startup log reports per-slot
# n_ctx, which is exactly the diagnostic that catches ctx misconfig.
]
if tp > 1:
# Tensor-parallel split across the visible GPUs (caller restricts the
# set via CUDA_VISIBLE_DEVICES in launch_env). Row-split is llama.cpp's
# tensor-parallel mode (vs the default layer/pipeline split).
cmd += ["--split-mode", "row"]
return cmd