Skip to content

Commit e07f9d7

Browse files
authored
Merge pull request #622 from deepmodeling/cuda11
Merge from cuda11 to develop
2 parents 2eb52af + a65d797 commit e07f9d7

39 files changed

+8578
-1496
lines changed

CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ project(ABACUS
1414
option(ENABLE_DEEPKS "Enable DeePKS functionality" OFF)
1515
option(ENABLE_LIBXC "Enable LibXC functionality" OFF)
1616
option(USE_CUDA "Enable support to CUDA." OFF)
17+
option(USE_ROCM "Enable support to ROCm." OFF)
1718
option(USE_OPENMP " Enable OpenMP in abacus." ON)
1819
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
1920
option(BUILD_TESTING "Build ABACUS unit tests" OFF)
@@ -80,6 +81,8 @@ if(USE_CUDA)
8081
-lcufft
8182
-lcublas
8283
-lcudart
84+
-lcusolver
85+
-lnvToolsExt
8386
)
8487
set_property(TARGET ${ABACUS_BIN_NAME}
8588
PROPERTY CUDA_ARCHITECTURES
@@ -91,6 +94,33 @@ if(USE_CUDA)
9194
add_compile_definitions(__CUDA)
9295
endif()
9396

97+
# Warning: CMake add support to HIP in version 3.21. This is rather a new version.
98+
# Use cmake with AMD-ROCm: https://rocmdocs.amd.com/en/latest/Installation_Guide/Using-CMake-with-AMD-ROCm.html
99+
if(USE_ROCM)
100+
set(CMAKE_CXX_STANDARD 11)
101+
SET(CMAKE_HIP_STANDARD 11)
102+
# set(CMAKE_CXX_STANDARD_REQUIRED True)
103+
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
104+
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "/opt/rocm/hip")
105+
106+
# find_package(ROCM REQUIRED)
107+
find_package(hip REQUIRED)
108+
find_package(hipfft REQUIRED)
109+
find_package(hipblas REQUIRED)
110+
include_directories(
111+
/opt/rocm/hip/include
112+
/opt/rocm/hipfft/include
113+
/opt/rocm/hipblas/include
114+
)
115+
target_link_libraries(${ABACUS_BIN_NAME}
116+
hip::device
117+
hip::host
118+
hip::hipfft
119+
roc::hipblas
120+
)
121+
add_compile_definitions(__ROCM)
122+
endif()
123+
94124
if(ENABLE_ASAN)
95125
add_compile_options(
96126
-O1

0 commit comments

Comments
 (0)