Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DFT][CMake] Check CUDA support with portFFT before using it as a target #511

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
options: -DTARGET_DOMAINS=blas -DREF_BLAS_ROOT=${PWD}/lapack/install -DENABLE_PORTBLAS_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DPORTBLAS_TUNING_TARGET=INTEL_CPU
tests: '.*'
- config: portFFT
options: -DENABLE_PORTFFT_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DTARGET_DOMAINS=dft -DCMAKE_CXX_FLAGS="-fsycl -fsycl-targets=spir64"
options: -DENABLE_PORTFFT_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DTARGET_DOMAINS=dft
tests: 'DFT/CT/.*ComputeTests_in_place_COMPLEX.COMPLEX_SINGLE_in_place_buffer.sizes_8_batches_1*'
- config: MKL BLAS
options: -DTARGET_DOMAINS=blas -DREF_BLAS_ROOT=${PWD}/lapack/install
Expand Down
3 changes: 3 additions & 0 deletions cmake/FindCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ if(is_dpcpp)
if(UNIX)
set(UNIX_INTERFACE_COMPILE_OPTIONS -fsycl)
set(UNIX_INTERFACE_LINK_OPTIONS -fsycl)
# Check if the Nvidia target is supported. PortFFT uses this for choosing default configuration.
check_cxx_compiler_flag("-fsycl -fsycl-targets=nvptx64-nvidia-cuda" dpcpp_supports_nvptx64)

if(ENABLE_CURAND_BACKEND OR ENABLE_CUSOLVER_BACKEND)
list(APPEND UNIX_INTERFACE_COMPILE_OPTIONS
-fsycl-targets=nvptx64-nvidia-cuda -fsycl-unnamed-lambda)
Expand Down
7 changes: 6 additions & 1 deletion src/dft/backends/portfft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ if (IS_DPCPP AND UNIX AND NOT FOUND_TARGETS)
set(TARGETS_LINK_OPTIONS -fsycl-unnamed-lambda)

# spir64 must be last in the list due to a bug in dpcpp 2024.0.0
set(TARGETS_TRIPLES "nvptx64-nvidia-cuda,spir64")
Rbiessy marked this conversation as resolved.
Show resolved Hide resolved
set(TARGETS_TRIPLES "spir64")
if(dpcpp_supports_nvptx64)
set(TARGETS_TRIPLES nvptx64-nvidia-cuda,${TARGETS_TRIPLES})
endif()

if (NOT (HIP_TARGETS STREQUAL ""))
set(TARGETS_TRIPLES amdgcn-amd-amdhsa,${TARGETS_TRIPLES})
Expand All @@ -45,6 +48,8 @@ if (IS_DPCPP AND UNIX AND NOT FOUND_TARGETS)
else()
message(WARNING "Can't enable hip backend, HIP_TARGETS has not been set.")
endif()

message(STATUS "portFFT target triple set to ${TARGETS_TRIPLES}")

list(APPEND TARGETS_COMPILE_OPTIONS -fsycl-targets=${TARGETS_TRIPLES})
list(APPEND TARGETS_LINK_OPTIONS -fsycl-targets=${TARGETS_TRIPLES})
Expand Down