Repository navigation
Size batch defaults from the hardware: keep CPUs free for repartition and give every GPU its own workers - #2824
Conversation
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…cit pools Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
|
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 new actionable issue was found. SummarySizes batch workers from CPU capacity, GPU count, and free GPU memory.
|
|
The failing The workflow triggers on |
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…L errors Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…d probe memory only when the driver holds every GPU Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
When the per-GPU cell sizes the GPU stages, page_elements_repartition and embed_repartition default to off unless set explicitly. The repartition tasks get too little Ray Data budget to feed the larger GPU pools. Single-GPU and fallback paths keep both repartitions. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…ay's GPUs, and check placement - Only the PDF graph gets the per-GPU cell; text, HTML, image, audio, video and auto graphs keep the previous defaults and repartitions. - The large cell needs the smallest free memory among the GPUs named by CUDA_VISIBLE_DEVICES to be at least 72 GiB; the chosen cell and the reason are logged at INFO. - Fractional-GPU actors report their GPU when they start, and the executor logs a WARNING when a pool has pending actors or an uneven count per GPU. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…est ends Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
| and getattr(extract_params, "use_page_elements", False) | ||
| and any( | ||
| getattr(extract_params, name, False) | ||
| for name in ("extract_text", "extract_tables", "extract_charts", "extract_infographics") |
There was a problem hiding this comment.
[P2] Gate the cell on the stages the graph actually creates. For method='pdfium', extract_text=True, and extract_tables/extract_charts/extract_infographics=False, this predicate is true, but build_graph only sets OCR extract_text for pdfium_hybrid/ocr; needs_ocr and page_elements_needed are both false. The resulting graph has neither PE nor OCR, yet receives the cell's tiny embedding GPU share and loses its embedding repartition. On eight large GPUs all eight 0.04-share embedding actors can pack onto one GPU. This contradicts the stated restriction to a PDF graph containing all three local pools. Please share the graph builder's needs_ocr/page_elements_needed calculation with this guard and cover the native-text-only PDF case.
There was a problem hiding this comment.
Good catch, fixed in 8820636. build_graph and the cell guard now share one helper, _pdf_ocr_needed(extract_params). The guard already requires use_page_elements and excludes table structure, so whenever this helper is true the graph builds page elements and OCR (page_elements_needed reduces to needs_ocr). A native-text-only pdfium graph therefore keeps the previous defaults. That case is now in test_per_gpu_cell_skips_graphs_with_other_gpu_pools. The default pdfium_hybrid plans on 256/8, 32/4 and 32/1 are byte-identical to 21a6ddb.
| (extract_params, "page_elements_invoke_url"), | ||
| (extract_params, "ocr_invoke_url"), | ||
| (embed_params, "embed_invoke_url"), | ||
| ) |
There was a problem hiding this comment.
[P2] Include the supported embedding_endpoint alias in the remote-embedding exclusion. EmbedParams(embedding_endpoint='http://embed:8000/v1/embeddings') leaves embed_invoke_url unset (normalization only copies the other direction), so this guard enables the cell for an HTTP embedder. That changes PE/OCR shares and disables both repartitions even though the description promises the previous defaults for remote embedding. Please reuse a normalized endpoint predicate here; _local_embed_requested above already checks both names. Add the embedding_endpoint variant alongside the existing embed_invoke_url fallback test.
There was a problem hiding this comment.
Fixed in 8820636. The remote-endpoint check now covers embedding_endpoint as well as embed_invoke_url, matching what _local_embed_requested accepts. EmbedParams(embedding_endpoint=...) sits next to the embed_invoke_url case in the fallback test.
…bedding_endpoint Share build_graph's OCR-stage check with the cell guard so a native-text-only pdfium graph (no page elements or OCR) keeps the previous defaults, and treat embedding_endpoint like embed_invoke_url. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
jperez999
left a comment
There was a problem hiding this comment.
This is a gotcha but your call on whether to fix, we are only responsible for single node. So all GPUs should be local.
| if gpus is None: | ||
| logger.info("CUDA_VISIBLE_DEVICES does not name GPU indices or UUIDs; using the small per-GPU cell") | ||
| return 0 | ||
| if len(gpus) < cluster_gpu_count: |
There was a problem hiding this comment.
[P2] A local GPU count cannot establish that the available Ray GPUs are local. The caller passes available_gpu_count, so this check permits the large cell whenever the driver exposes at least that many physical GPUs, even if Ray will schedule on remote, smaller GPUs. For example, a driver host with eight 96-GiB GPUs can connect to a Ray cluster whose four available GPUs are remote 48-GiB cards (the driver GPUs need not be registered as Ray resources); len(gpus)=8 >= 4 and the local NVML probe selects the large layout for those workers. A partially occupied multi-node cluster has the same ambiguity. I verified the helper returns 97,000 MiB for eight local 97,000-MiB entries and a cluster count of two. This contradicts the stated multi-node fallback and can oversubscribe worker VRAM. Please conservatively choose the small cell unless the schedulable GPU node identity is verified to be this host, or gather memory on eligible Ray nodes. Add coverage where the local NVML count exceeds the available remote GPU count; the existing fewer-local-GPUs check does not cover that case.
There was a problem hiding this comment.
Made the conservative change in df13654. The large cell is now used only when Ray's available GPU count equals the number of GPUs this host exposes to Ray (!= instead of <); in every other case the small cell is used and the counts are logged at INFO. test_gpu_cell_memory_needs_ray_gpus_to_match_local_gpus covers 8 local GPUs against 2 or 4 Ray GPUs. Resolved plans on 256/8, 32/4 and 32/1 are byte-identical to 8820636. Supporting multi-node clusters (probing memory on the Ray nodes themselves) stays out of scope, since NRL supports only single-node.
…t exposes Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Summary
Batch defaults are now sized from the hardware: CPU and GPU workers follow the host's CPUs, GPU count and GPU memory. On large hosts the defaults no longer stall and match our hand-tuned layout. Settings you pass yourself are used as is.
64f85b2pages/sSetup: no ingest settings passed, fresh container per run. bo10k is 10,000 PDFs (213,538 pages), cold cache; bo767 is 767 PDFs (54,730 pages). PR head
21a6ddbon 8x RTX PRO 6000 and 4x L40S. On 1x H100 the run used72bd8bf; later commits do not change the 1-GPU plan. One run per arm; single-run spread on the 8-GPU box is usually 0.4–2.7%.What changed
map_batchesstill bundles rows up to the batch size.Why it's safe
*_workers,*_cpus_per_actor,gpu_*,embed_reshape_workersornode_overridesvalue is used as is and never shrunk.page_elements_repartitionandembed_repartitionare nowOptional[bool]:Nonemeans automatic, andTrue/Falseare honored.CUDA_VISIBLE_DEVICES), and the chosen set and reason are logged at INFO. After the GPU actors start, a WARNING names any pending actors or uneven per-GPU counts.docs/docs/extraction/performance_guide.mddescribes each default.Not tested: other GPU models, text-only and audio pipelines, and Kubernetes/Helm deployments.
Details: formulas, measurement ladder, resolved plans
CPU reserve.
Growth order: CPU-only pools up to min(2 per GPU, target / 8), then GPU pools, then the rest. GPU actors count against the same budget. To restore the old PDF booking, set
pdf_extract_num_cpus=2or--pdf-extract-cpus-per-task 2.8x RTX PRO 6000, 256 CPUs, bo10k, cold cache, one run per arm. Each row adds one change.
64f85b2250a24b)408ecb0)00a717c)00a717c+page_elements_repartition=false21a6ddbFinal head: 0 failed batches, 0 bad vectors, no OOM, nDCG@10 0.623, first embedding output at +160 s.
4x L40S (46 GiB usable), 32 CPUs, bo767, one run per arm.
64f85b2408ecb0(per-GPU set)21a6ddb(final)Final head plan: 9 PDF x 1 CPU, 2 reshape, 1 PE + 1 OCR + 1 embed on every GPU, both regroups off. Ray booked 31-32/32 CPUs for the first ~4.5 min, then 23/32. 0 failed batches, no OOM. The +14% over
408ecb0is not split between removing the regroups and the extra PDF and reshape workers they free.1x H100 NVL, 32 CPUs, bo767, one run per arm, OS page cache not dropped.
64f85b2250a24b72bd8bfOn main, the repartition before embedding had 0 CPU for ~27 min (586 queued blocks), so nothing was embedded until PDF extraction finished. With the reserve it never queued more than 1 block.
Resolved default plans (the real
batch_tuning_to_node_overridesplus preflight on simulated clusters; CPUs booked includes the source read, PDF split and document-to-PDF actors):