Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ if (USE_OMP)
endif()
if (USE_ACC)
find_package(OpenACC REQUIRED)
# Provides CUDA::cublas / CUDA::cusolver imported targets (headers + libs),
# so the GPU build does not depend on CPATH from the developer's shell
# reaching the compiler (see issue #98)
find_package(CUDAToolkit REQUIRED)
endif()

set(CMAKE_CXX_STANDARD 14)
Expand Down
8 changes: 4 additions & 4 deletions SlaterGPUConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ find_dependency(MPI REQUIRED)
find_dependency(BLAS REQUIRED)
find_dependency(LAPACK REQUIRED)

# Find CUDA if available
find_package(CUDA QUIET)
if(CUDA_FOUND)
enable_language(CUDA)
# The GPU build links CUDA::cublas / CUDA::cusolver, which consumers need
# to resolve from the exported SlaterGPU target
if(@USE_ACC@)
find_dependency(CUDAToolkit REQUIRED)
endif()

# Include the targets file
Expand Down
20 changes: 6 additions & 14 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,16 @@ set(TEST_COMP_FLAGS ${CMAKE_CXX_FLAGS})

# CUDA/GPU dependencies - only when USE_ACC is enabled
if(USE_ACC)
enable_language(CUDA)
find_package(CUDA REQUIRED)
find_library(CUDART_LIBRARY cudart ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})

target_link_options(sgpu.exe PRIVATE
target_link_options(sgpu.exe PRIVATE
-acc=gpu
)
set(TEST_COMP_FLAGS ${TEST_COMP_FLAGS}
set(TEST_COMP_FLAGS ${TEST_COMP_FLAGS}
-DUSE_ACC=1 -acc=gpu
)

# GPU-specific link libraries
set(GPU_LIBRARIES
"${CUDART_LIBRARY}"
"${CUDA_LIBRARIES}"
"${CUDA_TOOLKIT_ROOT_DIR}/../../math_libs/lib64/libcublas.so"
"${CUDA_TOOLKIT_ROOT_DIR}/../../math_libs/lib64/libcusolver.so"
)

# GPU-specific link libraries; cuBLAS/cuSolver come transitively from
# the SlaterGPU target (CUDA::cublas / CUDA::cusolver)
set(GPU_LIBRARIES CUDA::cudart)
else()
# CPU-only mode
set(GPU_LIBRARIES "")
Expand Down
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "0.1.14"

[package.build.backend]
name = "pixi-build-cmake"
version = ">=0.3.6,<=0.4.2"
version = ">=0.3.6,<=0.4.5"

[package.build.config]
compilers = []
Expand Down
3 changes: 3 additions & 0 deletions src/integrals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ if(USE_ACC)
target_compile_options(SlaterGPU PRIVATE
${SLATER_COMP_FLAGS} -DUSE_ACC=1 -acc=gpu
)
# PUBLIC: cuda_util.h includes cublas_v2.h/cusolverDn.h when USE_ACC,
# so dependents (io, sgpu.exe, consumers) need the headers and libraries too
target_link_libraries(SlaterGPU PUBLIC CUDA::cublas CUDA::cusolver)
else()
target_compile_options(SlaterGPU PRIVATE
${SLATER_COMP_FLAGS} -DUSE_ACC=0
Expand Down
Loading