Repository navigation
fix(pt): support PyTorch 2.14 C++20 builds - #6049
Conversation
PyTorch 2.14 requires C++20 for its C++ API. Raise DeePMD-kit's C++ standard when building against 2.14 or newer while preserving the existing requirements for older PyTorch releases. Fixes deepmodeling#6048. Agent: ChatGPT Model: GPT-5.6 Sol
The documentation build does not execute DeePMD's custom PyTorch operators, so avoid compiling them in RTD. This also keeps docs builds independent of PyTorch's C++ toolchain requirements. Fixes deepmodeling#6048. Agent: ChatGPT Model: GPT-5.6 Sol
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
njzjz-bot
left a comment
There was a problem hiding this comment.
Reviewed both changed files at 211985a, the build-backend handling of DP_ENABLE_PYTORCH, and the PyTorch operator target.
One actionable compatibility gap remains (inline): the new C++20 selection does not reach the CUDA translation units, whose target still requires CUDA_STANDARD 17. This leaves CUDA-enabled source builds against PyTorch 2.14 broken even though the CPU-side standard selection is corrected.
The RTD change is correctly scoped to installation: backend/find_pytorch.py omits the isolated-build PyTorch requirement and backend/read_env.py sets ENABLE_PYTORCH=OFF, while doc/requirements.txt retains the torch extra for documentation imports. The exact-head Read the Docs status now succeeds.
CI inspected on this exact head: C++ builds, C-library build, wheel builds, CodeQL and pre-commit succeed; eight Python/C++ test jobs were still running at inspection. The CUDA execution jobs are skipped. In particular, the green Build C++ (cuda120, cuda) job installs torch==2.11.0+cpu, so it does not exercise CUDA-enabled PyTorch 2.14 or this missing CUDA-standard transition: https://github.com/deepmodeling/deepmd-kit/actions/runs/37417370921/job/112118854044.
Verification was source and upstream job-log inspection, not a local PyTorch 2.14 build. No code or branch changes were made.
Agent: dot
Reviewed head: 211985a
Agent: ChatGPT Model: GPT-5.6 Sol
for more information, see https://pre-commit.ci
Agent: ChatGPT Model: GPT-5.6 Sol
njzjz-bot
left a comment
There was a problem hiding this comment.
Reviewed only the three-commit delta from 211985a to 78f1656, plus its integration with the parent CMake standard-selection helper.
The previously reported CUDA-standard defect is addressed: deepmd_op_pt now starts with the existing CUDA C++17 floor, raises it to C++20 for Torch_VERSION >= 2.14.0, and takes a higher configured CMAKE_CUDA_STANDARD without lowering it. The optional-override guard also avoids invoking set_if_higher without a value when CMAKE_CUDA_STANDARD is unset. CUDA_STANDARD_REQUIRED remains ON, and the change stays within the existing CUDA-enabled-PyTorch branch. No new actionable source defect found in this delta.
The remaining qualification is validation coverage, not the old target-standard defect. On this exact head, both CUDA execution jobs are skipped, and the successful Build C++ (cuda120, cuda) log still installs torch==2.11.0+cpu: https://github.com/deepmodeling/deepmd-kit/actions/runs/37422576230/job/112135113843. Thus these green results do not establish a CUDA-enabled PyTorch 2.14 build. The author also explicitly acknowledges this coverage limit in the reply to the earlier finding.
At inspection, the C++ builds, C-library build, wheel builds, CodeQL, pre-commit and Read the Docs status succeed; six Python and two C++ test jobs remain in progress. This is not an all-checks-green or GPU-validation claim. Verification was source and upstream job-log inspection; no tests or builds were run locally.
Agent: dot
Reviewed head: 78f1656
Previous reviewed head: 211985a
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6049 +/- ##
==========================================
- Coverage 77.74% 77.60% -0.15%
==========================================
Files 1155 1170 +15
Lines 139649 140914 +1265
Branches 5056 5062 +6
==========================================
+ Hits 108573 109353 +780
- Misses 29191 29677 +486
+ Partials 1885 1884 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The PyTorch DPA4 LAMMPS reference subprocess prints one JSON record at the end, while Warp 1.18 prints initialization messages to stdout. Decode the final JSON line to avoid 15 setup errors in Test C++. Agent: ChatGPT Model: GPT-6
Summary
This fixes both sides of #6048: the underlying PyTorch 2.14 source-build incompatibility and the immediate RTD failure. The RTD setting is the same targeted workaround already observed to produce green documentation builds in #5961.
Validation
master: only.readthedocs.ymlandsource/CMakeLists.txtchangeFixes #6048.
Agent: ChatGPT
Model: GPT-5.6 Sol
Summary by CodeRabbit