fix(docling): reserve the GPU from Ray cluster resources, not local CUDA (#580) - #584
Conversation
…UDA (#580) _docling_num_gpus ran inside the DoclingPool actor (scheduled with no GPU), so torch.cuda.is_available() was False there, it reserved 0 GPUs for the worker, and Docling silently parsed on CPU (~5-10x slower than marker; no DoclingWorker on nvidia-smi). Mirror _marker_num_gpus: query the Ray cluster for GPU capacity, with local CUDA only as a startup fallback. Tests cover cluster-has-GPU/CUDA-hidden -> reserves, no cluster GPU -> 0, and not-requested -> 0.
|
Warning Review limit reached
More reviews will be available in 59 minutes and 58 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Testing independently (no other PR needed)Unit: Functional standalone — set docling as the global backend (
|
| if requested_gpus <= 0: | ||
| return 0 | ||
| try: | ||
| return requested_gpus if ray.cluster_resources().get("GPU", 0) > 0 else 0 |
There was a problem hiding this comment.
This fixes fresh DoclingPool creation, but it may not take effect during a live upgrade. Startup uses get_or_create_actor("DoclingPool", ...), so if the old detached actor is still alive, it will keep its existing workers that were created with num_gpus=0. The deployment would still parse on CPU until someone manually restarts DoclingPool.
For this PR, it would be good to either add a small migration/restart guard for the existing actor, or call out clearly that DoclingPool must be restarted after deploying the fix.
There was a problem hiding this comment.
I re-checked this. The code fix is already enough for any newly created DoclingPool. The only remaining case is a live upgrade with an old detached pool still running, and we can handle that by restarting DoclingPool after deployment. So I don’t think we need an extra code change here.
Docling parsed entirely on CPU (~5-10x slower than marker; no
DoclingWorkeronnvidia-smi)._docling_num_gpus()ran inside theDoclingPoolactor — scheduled with no GPU, sotorch.cuda.is_available()was False there and it reserved 0 GPUs for the worker, leaving Docling'sAcceleratorDevice.AUTOon CPU.Mirror
_marker_num_gpus(): query the Ray cluster for GPU capacity, with local CUDA only as a startup fallback. (Marker got this fix earlier; Docling never did.)Validated: with the fix,
DoclingWorkershows on the GPU and per-doc parse dropped from ~123s to ~10s (on par with marker). Tests cover cluster-has-GPU/CUDA-hidden → reserves, no cluster GPU → 0, not requested → 0. Refs #580.