fix(pt): select device before loading torch ops - #5612
Conversation
Preselect the CUDA/HIP device from the rank-local GPU before PyTorch CUDA queries or torch custom-op loading can create a default-device context. This avoids each MPI rank leaving an unused context on GPU 0 in multi-GPU LAMMPS runs. Fixes deepmodeling#4171 Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5) Signed-off-by: njzjz-bot (driven by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5))[bot] <48687836+njzjz-bot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughA new inline helper ChangesGPU Preselection Refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #5612 +/- ##
==========================================
+ Coverage 79.03% 79.36% +0.33%
==========================================
Files 1055 1085 +30
Lines 122233 126419 +4186
Branches 4401 4597 +196
==========================================
+ Hits 96607 100334 +3727
- Misses 24061 24434 +373
- Partials 1565 1651 +86 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Need a real test on a machine with multiple GPUs. |
|
Possible reviewers based on changed lines, exact file history, and exact-file review history:
No review request was made automatically. Coding agent: Codex |
njzjz-bot
left a comment
There was a problem hiding this comment.
Reviewed draft head 5532e79536ee314aeea2a90a79f241a16afbe51d with three independent full subagent reviews. Two P2 initialization issues remain inline: raw runtime preselection is keyed to the DeePMD toolkit rather than LibTorch's GPU capability, and the exportable initializers mutate device state before rejecting unsupported in-memory content. The intended selection-before-op-load ordering is otherwise consistent across the five PT initialization paths. Several C++ and wheel checks are currently failing/cancelled and need investigation after the fixes. Because this PR was opened by the active njzjz-bot account, this is a comment-only review rather than a self-request-changes event.
The quota is about to reset, so I am concentrating the remaining token budget on these reviews.
Coding agent: Codex
Codex version: codex-cli 0.144.6
Model: gpt-5.6-sol
Reasoning effort: xhigh
Gate raw runtime device preselection on LibTorch GPU support and reject unsupported in-memory PT2 content before device or operator-library side effects. Coding-Agent: Codex Codex-Version: codex-cli 0.144.6 Model: gpt-5.6-sol Reasoning-Effort: xhigh
for more information, see https://pre-commit.ci
Summary
DeepPotPT,DeepSpinPT,DeepTensorPT,DeepPotPTExpt,DeepSpinPTExpt) to call this helper beforedeepmd::load_op_library().Verification
git diff --check HEAD~1..HEADpreselect_torch_deviceprecedesdeepmd::load_op_library()in all touched PT init paths.Fixes #4171
Authored by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5)
Summary by CodeRabbit