diff --git a/.readthedocs.yml b/.readthedocs.yml index 4b829fc279..9631c71e80 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,7 +7,8 @@ build: post_create_environment: - pip install uv post_install: - - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install -r doc/requirements.txt + # RTD renders documentation without executing custom PyTorch operators. + - DP_ENABLE_PYTORCH=0 VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install -r doc/requirements.txt apt_packages: - inkscape sphinx: diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 1161f59ee7..4ccc18542c 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -404,7 +404,10 @@ if(ENABLE_PYTORCH AND NOT DEEPMD_C_ROOT) else() set(DEEPMD_TORCH_HAS_CUDA FALSE) endif() - if(NOT Torch_VERSION VERSION_LESS "2.1.0") + # PyTorch 2.14 raised the minimum C++ standard from C++17 to C++20. + if(NOT Torch_VERSION VERSION_LESS "2.14.0") + set_if_higher(CMAKE_CXX_STANDARD 20) + elseif(NOT Torch_VERSION VERSION_LESS "2.1.0") set_if_higher(CMAKE_CXX_STANDARD 17) elseif(NOT Torch_VERSION VERSION_LESS "1.5.0") set_if_higher(CMAKE_CXX_STANDARD 14) diff --git a/source/lmp/tests/dpa4_spin_harness.py b/source/lmp/tests/dpa4_spin_harness.py index c48eb5f600..26a4cd3f95 100644 --- a/source/lmp/tests/dpa4_spin_harness.py +++ b/source/lmp/tests/dpa4_spin_harness.py @@ -176,7 +176,8 @@ def compute_expected( proc = sp.run([sys.executable, "-c", script], capture_output=True, text=True) if proc.returncode != 0: raise RuntimeError(f"Failed to compute expected values:\n{proc.stderr}") - result = json.loads(proc.stdout.strip()) + # Warp and other backends may log to stdout before the final JSON payload. + result = json.loads(proc.stdout.strip().splitlines()[-1]) # Raw DeepEval force_mag (dE/dspin), scaled by LAMMPS's own # spin_norm / hbar unit convention (see HBAR_METAL) before comparison. diff --git a/source/lmp/tests/test_lammps_dpa4_chg_spin_deepspin_pt2.py b/source/lmp/tests/test_lammps_dpa4_chg_spin_deepspin_pt2.py index 3d76b17aac..775725c703 100644 --- a/source/lmp/tests/test_lammps_dpa4_chg_spin_deepspin_pt2.py +++ b/source/lmp/tests/test_lammps_dpa4_chg_spin_deepspin_pt2.py @@ -180,7 +180,8 @@ def _compute_expected() -> None: proc = sp.run([sys.executable, "-c", script], capture_output=True, text=True) if proc.returncode != 0: raise RuntimeError(f"Failed to compute expected values:\n{proc.stderr}") - result = json.loads(proc.stdout.strip()) + # Warp and other backends may log to stdout before the final JSON payload. + result = json.loads(proc.stdout.strip().splitlines()[-1]) # Raw DeepEval force_mag (dE/dspin), scaled by LAMMPS's own # spin_norm / hbar unit convention (see ``_HBAR_METAL`` above) before diff --git a/source/lmp/tests/test_lammps_dpa4_zbl_pt2.py b/source/lmp/tests/test_lammps_dpa4_zbl_pt2.py index 099e236294..32f20257df 100644 --- a/source/lmp/tests/test_lammps_dpa4_zbl_pt2.py +++ b/source/lmp/tests/test_lammps_dpa4_zbl_pt2.py @@ -188,7 +188,8 @@ def _compute_expected() -> None: proc = sp.run([sys.executable, "-c", script], capture_output=True, text=True) if proc.returncode != 0: raise RuntimeError(f"Failed to compute expected values:\n{proc.stderr}") - result = json.loads(proc.stdout.strip()) + # Warp and other backends may log to stdout before the final JSON payload. + result = json.loads(proc.stdout.strip().splitlines()[-1]) expected_e = result["e"] expected_ae = np.array(result["ae"]) diff --git a/source/op/pt/CMakeLists.txt b/source/op/pt/CMakeLists.txt index 6948f50335..ddfe38253b 100644 --- a/source/op/pt/CMakeLists.txt +++ b/source/op/pt/CMakeLists.txt @@ -212,9 +212,18 @@ if(USE_CUDA_TOOLKIT AND DEEPMD_TORCH_HAS_CUDA) ${DEEPMD_PT_CUDA_ARCHITECTURES}) endif() target_link_libraries(deepmd_op_pt PRIVATE CUDA::cublas CUDA::cublasLt) - # libtorch headers require C++17; the CUDA sources must match. - set_target_properties(deepmd_op_pt PROPERTIES CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON) + # libtorch headers require at least C++17, and PyTorch 2.14+ requires C++20. + # Preserve an explicitly higher CUDA standard requested by the user. + set(DEEPMD_PT_CUDA_STANDARD 17) + if(NOT Torch_VERSION VERSION_LESS "2.14.0") + set_if_higher(DEEPMD_PT_CUDA_STANDARD 20) + endif() + if(CMAKE_CUDA_STANDARD) + set_if_higher(DEEPMD_PT_CUDA_STANDARD ${CMAKE_CUDA_STANDARD}) + endif() + set_target_properties( + deepmd_op_pt PROPERTIES CUDA_STANDARD ${DEEPMD_PT_CUDA_STANDARD} + CUDA_STANDARD_REQUIRED ON) if(DEEPMD_ENABLE_DPA1_HIGH_LMAX) target_compile_definitions(deepmd_op_pt PRIVATE DEEPMD_ENABLE_DPA1_HIGH_LMAX=1)