From e783293515521b8e9e1684537b2aa49248176cfc Mon Sep 17 00:00:00 2001 From: caic99 Date: Tue, 14 Nov 2023 11:26:27 +0800 Subject: [PATCH] fix torch build on cuda-12 --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dca166b6ee..ef1c95f27c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,6 +239,9 @@ if(USE_CUDA OR USE_CUSOLVER_LCAO) set(CMAKE_CUDA_ARCHITECTURES 60 # P100 70 # V100 + # Add your CUDA arch here + # Check the Compute Capability version of your GPU at: + # https://en.wikipedia.org/wiki/CUDA#GPUs_supported ) if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.0) list(APPEND CMAKE_CUDA_ARCHITECTURES 75) # T4 @@ -250,7 +253,7 @@ if(USE_CUDA OR USE_CUSOLVER_LCAO) list(APPEND CMAKE_CUDA_ARCHITECTURES 86) endif() if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.8) - list(APPEND CMAKE_CUDA_ARCHITECTURES 89) + list(APPEND CMAKE_CUDA_ARCHITECTURES 89 90) endif() endif() enable_language(CUDA) @@ -387,6 +390,9 @@ endif() if(ENABLE_DEEPKS) set(CMAKE_CXX_STANDARD 14) + # Torch uses outdated components to detech CUDA arch, causing failure on latest CUDA kits. + # See above for setting CMAKE_CUDA_ARCHITECTURES + set(TORCH_CUDA_ARCH_LIST CMAKE_CUDA_ARCHITECTURES) find_package(Torch REQUIRED) include_directories(${TORCH_INCLUDE_DIRS}) target_link_libraries(${ABACUS_BIN_NAME} deepks)