onprem-llm-benchmark / REPRODUCING.md
matheusserpa's picture
docs: REPRODUCING.md destaca portable-slurm + run_all.sh (qualquer cluster/Frontier) na home
65cfe88 verified
|
Raw History Blame Contribute Delete
8.93 kB

Reproducing the Scherm On-Premise LLM Inference Benchmark

This guide explains exactly how to reproduce every experiment in this dataset, on each hardware platform we used. Pick the section that matches your hardware.

🚀 Running on YOUR OWN Slurm cluster (any vendor)?

Use the self-contained portable jobs in scripts/portable-slurm/ — they recreate everything from scratch (download the runners straight from this repo, auto-detect nothing you have to pre-install). Four flavors: nvidia_container · nvidia_venv · amd_container · amd_venv (AMD/ROCm covers Frontier/ORNL). See scripts/portable-slurm/README.md for which to pick. To submit all benchmarks at once (every model × every task) with one chosen sbatch, use scripts/portable-slurm/run_all.sh — run it with DRY_RUN=1 first to preview every sbatch command without submitting anything. The sections below document our specific clusters; the portable jobs are what you run elsewhere.

Golden rule — always run with the GPU/node fully dedicated. Every measurement in this dataset was taken on an exclusive GPU (no other job sharing it). Sharing a GPU contaminates throughput and breaks reproducibility. On Slurm this means --exclusive; on a single-GPU box it means "nothing else using the GPU".


0. Prerequisites (all platforms)

You need a Hugging Face token (gated models like Llama need it). Never hardcode it in a script — export it into your shell:

export HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The runners (scripts/runners/*.py) are shared across all platforms. They talk to an OpenAI-compatible server (vLLM) — except the STT runner, which uses faster-whisper directly.

Critical gotchas baked into these scripts (don't undo them):

  • run_serving.py passes --base-url http://HOST:PORT without /v1. The vllm bench serve tool appends /v1/completions itself — adding /v1 yourself produces /v1/v1/completions → 404 → 0 tok/s silently.
  • Vision/OCR models (NuMarkdown, Qwen-VL, DeepSeek-OCR) require --trust-remote-code.
  • DeepSeek-OCR needs --logits_processors ...NGramPerReqLogitsProcessor --no-enable-prefix-caching --mm-processor-cache-gb 0 AND a vLLM build with torchaudio (use the official vllm/vllm-openai image, not the NGC image — NGC lacks torchaudio and the model fails architecture inspection).

1. Slurm cluster (GPPD-HPC / UFRGS) — multi-GPU, NVIDIA + AMD

Where: scripts/gppd-slurm/ (job definitions) + scripts/runners/ (the actual benchmark code).

The job_*.sbatch scripts read ~/.scherm_hf_token, set up an HF cache on $SCRATCH, pull a vLLM container with podman (fuse-overlayfs), start the server, then run the matching runner.

Step by step

# 1. Put your token where the jobs expect it (login node):
echo 'export HF_TOKEN=hf_xxxx' > ~/.scherm_hf_token

# 2. Copy the runners next to the jobs (jobs cp them into $SCRATCH at runtime):
cp scripts/runners/*.py ~/scherm-bench-v2/

# 3. Submit a job — ALWAYS with --exclusive, choosing the partition for your GPU:
#    serving (chat throughput):
MODEL=Qwen/Qwen2.5-32B-Instruct-AWQ MAXLEN=8192 \
  sbatch --exclusive -p tupi --gres=gpu:1 scripts/gppd-slurm/job_serving.sbatch

#    embeddings:
MODEL=BAAI/bge-m3 MAXLEN=8192 \
  sbatch --exclusive -p tupi --gres=gpu:1 scripts/gppd-slurm/job_embed.sbatch

#    reranker:
MODEL=BAAI/bge-reranker-v2-m3 MAXLEN=8192 \
  sbatch --exclusive -p tupi --gres=gpu:1 scripts/gppd-slurm/job_rerank.sbatch

#    vision / OCR:
SCHERM_VL_MODELS="Qwen/Qwen2.5-VL-7B-Instruct|8192|1" \
  sbatch --exclusive -p tupi --gres=gpu:1 scripts/gppd-slurm/job_vision.sbatch

#    STT (Whisper, x86 nodes only — see note):
sbatch --exclusive -p tupi --gres=gpu:1 scripts/gppd-slurm/job_stt.sbatch

#    AMD GPUs (Radeon, ROCm) — text serving only, via ollama:
sbatch --exclusive -p lunaris --gres=gpu:1 scripts/gppd-slurm/job_ollama_rocm.sbatch

# 4. Results land in ~/scherm-bench-v2/results/  (one CSV per model+run).
# 5. Merge into *_ALL.csv:
python scripts/runners/merge_results.py --results ~/scherm-bench-v2/results --out ~/merged

Partition → GPU map at GPPD: tupi=RTX 4090, poti=RTX 4070, grace=L40S (ARM), lunaris/sirius=AMD RX 7900 XT, blaise=Tesla P100.

Physical ceilings (why some cells are empty in the dataset): AMD GPUs run text serving via ollama-ROCm only (vLLM pooling/vision and CTranslate2-STT have no ROCm path → these fail); the L40S node here is Grace (ARM/aarch64), where faster-whisper/CTranslate2 won't compile, so STT fails there; pre-2020 GPUs (P100/1080Ti/2080Ti/K20m/K80) don't run modern vLLM (ollama + embed only).


2. NVIDIA B200 (Apptainer, on an Slurm login→compute cluster)

Where: scripts/b200-apptainer/.

The B200 cluster uses Apptainer (not Docker/podman) and the NGC vLLM image. Same runners.

# 1. One-time setup (pulls NGC image into a persistent path, e.g. beegfs):
bash scripts/b200-apptainer/setup_b200.sh

# 2. Token on the COMPUTE node (Slurm login home ≠ compute home — copy it over):
printf 'export HF_TOKEN=hf_xxxx' > ~/.scherm_hf_token   # on the node the job runs on

# 3. Launch the full matrix (TP=1/2/4/8 sweeps included):
bash scripts/b200-apptainer/launch_matrix_b200.sh
#    or a single job, exclusive + yielding priority to the cluster owner:
MODEL=Qwen/Qwen2.5-72B-Instruct-AWQ TP=4 \
  sbatch --exclusive --nice=10000 scripts/b200-apptainer/job_serving_b200.sbatch

--nice=10000 is intentional on B200 — it is a shared/owner cluster, so benchmark jobs must yield priority. The --nice is in the sbatch header and the launch command (defense in depth). Store the NGC image on a persistent filesystem (beegfs) — the B200 node's local /scratch recycles with the node.


3. Single NVIDIA GPU with Docker (RTX PRO 6000 Blackwell, etc.)

Where: scripts/rtx-docker/.

For Blackwell (sm_120/sm_121) you need the NGC vLLM image (nvcr.io/nvidia/vllm:26.03.post1-py3) — stock vLLM v0.11 has no Blackwell kernels. DeepSeek-OCR is the exception (see below).

export HF_TOKEN=hf_xxxx

# Chat / serving + embed + rerank + vision + STT, one model after another (each exclusive on the GPU):
bash scripts/rtx-docker/rtx_fix_serving.sh      # serving (chat throughput) — base-url WITHOUT /v1
bash scripts/rtx-docker/rtx_stack_completa.sh   # full stack: embed, rerank, vision, STT, chat

# DeepSeek-OCR — uses the OFFICIAL vllm image (NGC lacks torchaudio → arch inspection fails):
bash scripts/rtx-docker/rtx_deepseek_oficial.sh

These scripts already encode the hard-won fixes:

  • free the port + validate the server serves the exact model before benchmarking (no false-ready),
  • --gpu-memory-utilization tuned so KV-cache fits,
  • faster-whisper STT installs nvidia-cublas-cu12 nvidia-cudnn-cu12 (NGC doesn't expose them to CTranslate2),
  • single disk: clear already-benchmarked model weights from ~/.cache/huggingface before pulling the next big one.

The user scherm is in the docker group, so docker runs without sudo. If yours isn't, add sudo or add your user to the group.


4. NVIDIA DGX Spark (GB10, unified memory) — ollama

Where: scripts/spark-ollama/.

The Spark runs models via ollama (not vLLM). Text serving + embeddings.

export HF_TOKEN=hf_xxxx     # for any gated pulls
bash scripts/spark-ollama/run_bench_spark.sh

Uses run_ollama.py (serving) and run_ollama_embed.py (embeddings) against the local ollama endpoint (default port noted inside the script).


5. Metrics each runner reports

Runner Server Metric
run_serving.py vLLM (vllm bench serve, random dataset) output tok/s, TTFT, TPOT per concurrency
run_embed.py vLLM --runner pooling embeddings/s, latency
run_rerank.py vLLM --runner pooling pairs/s, latency
run_vision.py vLLM (chat + image) tok/s, latency per concurrency
run_ocr_pages.py / run_ocr_accuracy.py vLLM (VLM) ms/page, tok/s; accuracy variant also saves extracted text
run_stt.py faster-whisper (no server) RTF, audio-seconds/s

All runners take --reps (repetitions for medians) and write one CSV per model. merge_results.py concatenates them into <modality>_ALL.csv and reports *_FAIL.csv shards separately.


6. Engine note (important for fair comparison)

Most results use the NGC vLLM image (26.03.post1, engine v0.17.1) for uniformity and Blackwell support. A few early runs used stock vLLM v0.11.0 — these are marked in the data. DeepSeek-OCR uses the official vllm/vllm-openai image. When comparing across GPUs, prefer rows with the same engine.