diff --git a/backend/read_env.py b/backend/read_env.py index 482f9766a0..8a173513f9 100644 --- a/backend/read_env.py +++ b/backend/read_env.py @@ -46,15 +46,15 @@ def get_argument_from_env() -> tuple[str, list, list, dict, str, str]: # get variant option from the environment variables, available: cpu, cuda, rocm dp_variant = os.environ.get("DP_VARIANT", "cpu").lower() if dp_variant == "cpu" or dp_variant == "": - cmake_minimum_required_version = "3.16" + cmake_minimum_required_version = "3.25.2" elif dp_variant == "cuda": - cmake_minimum_required_version = "3.23" + cmake_minimum_required_version = "3.25.2" cmake_args.append("-DUSE_CUDA_TOOLKIT:BOOL=TRUE") cuda_root = os.environ.get("CUDAToolkit_ROOT") if cuda_root: cmake_args.append(f"-DCUDAToolkit_ROOT:STRING={cuda_root}") elif dp_variant == "rocm": - cmake_minimum_required_version = "3.21" + cmake_minimum_required_version = "3.25.2" cmake_args.append("-DUSE_ROCM_TOOLKIT:BOOL=TRUE") rocm_root = os.environ.get("ROCM_ROOT") if not rocm_root: diff --git a/doc/install/install-from-source.md b/doc/install/install-from-source.md index a21b8913db..2acad95b69 100644 --- a/doc/install/install-from-source.md +++ b/doc/install/install-from-source.md @@ -377,7 +377,7 @@ mkdir build cd build ``` -The installation requires CMake 3.16 or later for the CPU version, CMake 3.23 or later for the CUDA support, and CMake 3.21 or later for the ROCM support. One can install CMake via `pip` if it is not installed or the installed version does not satisfy the requirement: +The installation requires CMake 3.25.2 or later for all platforms (CPU, CUDA, and ROCM). One can install CMake via `pip` if it is not installed or the installed version does not satisfy the requirement: ```sh pip install -U cmake diff --git a/examples/infer_water/CMakeLists.txt b/examples/infer_water/CMakeLists.txt index 27b7541c2d..c82816c912 100644 --- a/examples/infer_water/CMakeLists.txt +++ b/examples/infer_water/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.7) +cmake_minimum_required(VERSION 3.25.2) project(infer_water) # find DeePMD-kit diff --git a/pyproject.toml b/pyproject.toml index cb11d0258d..51e492c3bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -283,9 +283,8 @@ DP_ENABLE_IPI = "1" DP_ENABLE_PYTORCH = "1" DP_ENABLE_PADDLE = "1" # use CPU version of torch for building, which should also work for GPU -# note: uv has different behavior from pip on extra index url -# https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#packages-that-exist-on-multiple-indexes -UV_EXTRA_INDEX_URL = "https://download.pytorch.org/whl/cpu" +# https://docs.astral.sh/uv/guides/integration/pytorch/#automatic-backend-selection +UV_TORCH_BACKEND = "cpu" [tool.cibuildwheel.windows] test-extras = ["cpu", "torch", "paddle"] diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 2c13a5a367..b69fdea72c 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,5 +1,5 @@ -# new in 3.16: GET_RUNTIME_DEPENDENCIES, target_precompile_headers -cmake_minimum_required(VERSION 3.16) +# new in 3.25: RUN_OUTPUT_STDOUT_VARIABLE +cmake_minimum_required(VERSION 3.25.2) project(DeePMD) option(ENABLE_TENSORFLOW "Enable TensorFlow interface" OFF) @@ -244,7 +244,7 @@ set(DP_VARIANT "cpu") # define USE_CUDA_TOOLKIT if(USE_CUDA_TOOLKIT) - cmake_minimum_required(VERSION 3.23) + cmake_minimum_required(VERSION 3.25.2) find_package(CUDAToolkit REQUIRED) if(NOT DEFINED CMAKE_CUDA_COMPILER) set(CMAKE_CUDA_COMPILER ${CUDAToolkit_NVCC_EXECUTABLE}) @@ -261,7 +261,7 @@ endif(USE_CUDA_TOOLKIT) # define USE_ROCM_TOOLKIT if(USE_ROCM_TOOLKIT) - cmake_minimum_required(VERSION 3.21) + cmake_minimum_required(VERSION 3.25.2) include(CMakeDetermineHIPCompiler) list(APPEND CMAKE_PREFIX_PATH ${CMAKE_HIP_COMPILER_ROCM_ROOT}) find_package(hip REQUIRED) diff --git a/source/api_c/tests/CMakeLists.txt b/source/api_c/tests/CMakeLists.txt index c42055ba6f..16698ddf09 100644 --- a/source/api_c/tests/CMakeLists.txt +++ b/source/api_c/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.25.2) project(deepmd_api_c_test) file(GLOB TEST_SRC test_*.cc) diff --git a/source/api_cc/tests/CMakeLists.txt b/source/api_cc/tests/CMakeLists.txt index 5599b63243..cafeb3fd02 100644 --- a/source/api_cc/tests/CMakeLists.txt +++ b/source/api_cc/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.25.2) project(deepmd_api_test) file(GLOB TEST_SRC test_*.cc) diff --git a/source/lib/src/gpu/CMakeLists.txt b/source/lib/src/gpu/CMakeLists.txt index 0d176dc320..8aaf0c2904 100644 --- a/source/lib/src/gpu/CMakeLists.txt +++ b/source/lib/src/gpu/CMakeLists.txt @@ -1,6 +1,7 @@ if(USE_CUDA_TOOLKIT) - # required cmake version 3.23: CMAKE_CUDA_ARCHITECTURES all - cmake_minimum_required(VERSION 3.23) + # required cmake version 3.25: CMAKE_CUDA_ARCHITECTURES all, + # RUN_OUTPUT_STDOUT_VARIABLE + cmake_minimum_required(VERSION 3.25.2) # project name project(deepmd_op_cuda) set(GPU_LIB_NAME deepmd_op_cuda) @@ -54,7 +55,7 @@ if(USE_CUDA_TOOLKIT) elseif(USE_ROCM_TOOLKIT) # required cmake version - cmake_minimum_required(VERSION 3.21) + cmake_minimum_required(VERSION 3.25.2) # project name project(deepmd_op_rocm) enable_language(HIP) diff --git a/source/lib/tests/CMakeLists.txt b/source/lib/tests/CMakeLists.txt index f2fd8969d9..b8fbdcc00e 100644 --- a/source/lib/tests/CMakeLists.txt +++ b/source/lib/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.25.2) project(libdeepmd_test) file(GLOB TEST_SRC test_*.cc) diff --git a/source/lmp/plugin/CMakeLists.txt b/source/lmp/plugin/CMakeLists.txt index a4e7d9e430..8f32af3e3e 100644 --- a/source/lmp/plugin/CMakeLists.txt +++ b/source/lmp/plugin/CMakeLists.txt @@ -2,7 +2,7 @@ if(DEFINED LAMMPS_SOURCE_ROOT OR DEFINED LAMMPS_VERSION) message(STATUS "enable LAMMPS plugin mode") add_library(lammps_interface INTERFACE) if(DEFINED LAMMPS_VERSION) - cmake_minimum_required(VERSION 3.14) + cmake_minimum_required(VERSION 3.25.2) include(FetchContent) FetchContent_Declare( lammps_download