Skip to content

Commit

Permalink
fix torch build on cuda-12 (#3203)
Browse files Browse the repository at this point in the history
  • Loading branch information
caic99 authored Nov 14, 2023
1 parent aa382be commit cf870f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cf870f2

Please sign in to comment.