fix: probe CUDA context on correct device in set_task_pid()#230
fix: probe CUDA context on correct device in set_task_pid()#230maverick123123 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: maverick123123 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review 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 refer docs for additional details. ✨ 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 |
efcc7a2 to
01c7c41
Compare
|
@rootsongjc ready to merge |
503366d to
efcc7a2
Compare
set_task_pid() polls NVML processes on the first device where nvml_to_cuda_map(i) >= 0, but the probe context was always created on hardcoded CUDA device 0 via cuDevicePrimaryCtxRetain(&pctx, 0). When CUDA_VISIBLE_DEVICES does not start with the pod's device 0 (e.g., CVD=1 or CVD=1,0), the polled NVML device and the probe context device are different physical GPUs. getextrapid() never finds the new PID, causing a spurious 'host pid is error!' and subsequent Device 0 OOM due to incorrect memory accounting. Fix: use the cudaDev found in the NVML enumeration loop for both cuDevicePrimaryCtxRetain and cuDevicePrimaryCtxRelease, ensuring the probe context runs on the same device being polled. Fixes Project-HAMi#225 Signed-off-by: maverick123123 <yuming.wu@dynamia.ai>
01c7c41 to
ffcf6d7
Compare
|
/lgtm |
Problem
set_task_pid()insrc/utils.cpolls NVML processes on the first physical device wherenvml_to_cuda_map(i) >= 0, but the probe context is always created on hardcoded CUDA device 0 viacuDevicePrimaryCtxRetain(&pctx, 0).When
CUDA_VISIBLE_DEVICESdoes not start with the pod's device 0 (e.g.,CVD=1orCVD=1,0), the polled NVML device and the probe context device are different physical GPUs.getextrapid()never finds the new PID, causing a spurious "host pid is error!" and subsequent fake Device 0 OOM due to incorrect memory accounting.Fix
Save the
cudaDevfound in the NVML enumeration loop and use it for bothcuDevicePrimaryCtxRetainandcuDevicePrimaryCtxRelease, ensuring the probe context runs on the same device being polled.Also guard against the case where no NVML device maps to a CUDA device (probeDev remains -1) by returning early before retaining any context.
Testing
Verified on an 8x RTX 3090 machine with all CVD combinations:
010,11,0Related
Fixes #225