Skip to content

Commit

Permalink
Merge pull request #622 from deepmodeling/cuda11
Browse files Browse the repository at this point in the history
Merge from cuda11 to develop
  • Loading branch information
dyzheng committed Jan 14, 2022
2 parents 2eb52af + a65d797 commit e07f9d7
Show file tree
Hide file tree
Showing 39 changed files with 8,578 additions and 1,496 deletions.
30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ project(ABACUS
option(ENABLE_DEEPKS "Enable DeePKS functionality" OFF)
option(ENABLE_LIBXC "Enable LibXC functionality" OFF)
option(USE_CUDA "Enable support to CUDA." OFF)
option(USE_ROCM "Enable support to ROCm." OFF)
option(USE_OPENMP " Enable OpenMP in abacus." ON)
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
option(BUILD_TESTING "Build ABACUS unit tests" OFF)
Expand Down Expand Up @@ -80,6 +81,8 @@ if(USE_CUDA)
-lcufft
-lcublas
-lcudart
-lcusolver
-lnvToolsExt
)
set_property(TARGET ${ABACUS_BIN_NAME}
PROPERTY CUDA_ARCHITECTURES
Expand All @@ -91,6 +94,33 @@ if(USE_CUDA)
add_compile_definitions(__CUDA)
endif()

# Warning: CMake add support to HIP in version 3.21. This is rather a new version.
# Use cmake with AMD-ROCm: https://rocmdocs.amd.com/en/latest/Installation_Guide/Using-CMake-with-AMD-ROCm.html
if(USE_ROCM)
set(CMAKE_CXX_STANDARD 11)
SET(CMAKE_HIP_STANDARD 11)
# set(CMAKE_CXX_STANDARD_REQUIRED True)
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "/opt/rocm/hip")

# find_package(ROCM REQUIRED)
find_package(hip REQUIRED)
find_package(hipfft REQUIRED)
find_package(hipblas REQUIRED)
include_directories(
/opt/rocm/hip/include
/opt/rocm/hipfft/include
/opt/rocm/hipblas/include
)
target_link_libraries(${ABACUS_BIN_NAME}
hip::device
hip::host
hip::hipfft
roc::hipblas
)
add_compile_definitions(__ROCM)
endif()

if(ENABLE_ASAN)
add_compile_options(
-O1
Expand Down
Loading

0 comments on commit e07f9d7

Please sign in to comment.