Repository navigation
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
[Medium impact] The PR appears safe to merge; no actionable new issues were found. SummaryAdds opt-in blocking CUDA waits before GPU operators load models and before service workers warm models.
Reviews (6) · Last reviewed commit: "Make vLLM spawn workers when NRL_CUDA_BL..." · Reviewed by Greptile |
The flag calls cuInit in the process that builds a GPU operator. A local query embedder built in the driver process then forked its vLLM engine, and CUDA failed to initialize in the forked child. Default VLLM_WORKER_MULTIPROC_METHOD to spawn when the flag is on, keep an explicit user value, and note the throughput trade-off in the docs. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
|
Closing as explored and cut. The opt-in flag only paid off on a CPU-short host (8 GPUs on 64 CPUs: +4.5%, one run). It was neutral on hosts with spare CPU and cost about 4% on 1x H100 (repeated). Since then, start-time CPU sizing (#2824) and skipping unused image crops (#2841) leave more CPU free, so the target case is rarer, and it cannot be a default because it slows hosts with spare CPU. The branch is kept; reopen if a CPU-short deployment shows CUDA spin-waits limiting throughput on current main. |
Description
Why it helps
By default, a GPU worker keeps one CPU core at 100% while it waits for the GPU, checking over and over whether the work is done.
NRL_CUDA_BLOCKING_SYNC=1makes the worker sleep instead and wake when the GPU finishes, which frees those cores for CPU stages such as PDF extraction. That pays off when CPU is short: 8 GPUs on 64 CPUs went from 248.2 to 259.4 pages/s (+4.5%) with fewer busy cores (inference: the freed cores are what raised throughput; where they went was not traced). When CPU is plentiful there is nothing to gain and the wake-up adds a little latency (1x H100: about -4.2% over two runs), so the flag stays off by default.sequenceDiagram participant W as GPU worker on its CPU core participant G as GPU rect rgba(220, 80, 80, 0.12) Note over W,G: Default: spin-wait W->>G: launch batch loop until the GPU is done W->>W: poll, core busy at 100% end G-->>W: done end rect rgba(80, 180, 80, 0.12) Note over W,G: NRL_CUDA_BLOCKING_SYNC=1: blocking sync W->>G: launch batch Note over W: sleeps, core free for CPU stages G-->>W: done, wakes the worker after a short delay endCUDA's default schedule spin-waits on the host, so each local GPU actor burns about one CPU core polling the GPU. Setting
NRL_CUDA_BLOCKING_SYNC=1setsCU_CTX_SCHED_BLOCKING_SYNCon the primary contexts. This happens once per process, after Ray assigns the GPU and before any model loads:AbstractOperator.__init__forGPUOperatorsubclasses;Failures log a warning and retry at the next actor.
When the flag is on, NRL also defaults
VLLM_WORKER_MULTIPROC_METHODtospawn(an explicit user value is kept). A process that has calledcuInitcannot start CUDA in forked children. Without this, a local vLLM embedder built in the driver process (for example, for query-time embedding) forked its engine and failed with "CUDA driver initialization failed".Scope: the env var, a helper in
operators/gpu_operator.py, the two call sites, and docs inenvironment-config.md.Unchanged: when the variable is unset (the default), nothing is loaded, called, or set. vLLM EngineCore is a separate process and is not covered.
Measured, cold cache, single runs, recall@5/@10 within run-to-run noise:
=1=1When CPU is short, the cores freed from spinning go to the GPU stages' CPU work and raise throughput. On hosts with spare CPU they buy nothing, and on H100 the flag cost about 4%. Enable it only where CPU is the constraint.
Tests:
tests/test_cuda_blocking_sync.pycovers:spawndefault, and an explicitVLLM_WORKER_MULTIPROC_METHODkept;Checklist
Requested by: @jioffe502