Skip to content

Commit

Permalink
fix find logic in CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
yasahi-hpc committed Aug 20, 2024
1 parent 46e952f commit b6229d2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions cmake/KokkosFFT_tpls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ function(get_tpls_list tpls_list backend_list)
# Check if TPL is already included
list(FIND tpls_list "FFTW_OPENMP" idx_FFTW_OPENMP)
list(FIND tpls_list "FFTW_THREADS" idx_FFTW_THREADS)
if(Kokkos_ENABLE_OPENMP AND (idx_FFTW_OPENMP EQUAL -1))
if(Kokkos_ENABLE_OPENMP AND (${idx_FFTW_OPENMP} EQUAL -1))
list(APPEND tpls_list FFTW_OPENMP)
list(APPEND backend_list "Host Parallel")
elseif(Kokkos_ENABLE_THREADS AND (idx_FFTW_THREADS EQUAL -1))
elseif(Kokkos_ENABLE_THREADS AND (${idx_FFTW_THREADS} EQUAL -1))
list(APPEND tpls_list FFTW_THREADS)
list(APPEND backend_list "Host Parallel")
endif()
Expand Down
28 changes: 14 additions & 14 deletions common/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,47 @@ target_link_libraries(common
)

# Check which tpls are needed
list(FIND tpls_list "CUFFT" idx_CUFFT)
list(FIND tpls_list "ROCFFT" idx_ROCFFT)
list(FIND tpls_list "HIPFFT" idx_HIPFFT)
list(FIND tpls_list "ONEMKL" idx_ONEMKL)
list(FIND tpls_list "FFTW_OPENMP" idx_FFTW_OPENMP)
list(FIND tpls_list "FFTW_THREADS" idx_FFTW_THREADS)
list(FIND tpls_list "FFTW_SERIAL" idx_FFTW_SERIAL)
list(FIND KOKKOSFFT_TPL_LIST "CUFFT" idx_CUFFT)
list(FIND KOKKOSFFT_TPL_LIST "ROCFFT" idx_ROCFFT)
list(FIND KOKKOSFFT_TPL_LIST "HIPFFT" idx_HIPFFT)
list(FIND KOKKOSFFT_TPL_LIST "ONEMKL" idx_ONEMKL)
list(FIND KOKKOSFFT_TPL_LIST "FFTW_OPENMP" idx_FFTW_OPENMP)
list(FIND KOKKOSFFT_TPL_LIST "FFTW_THREADS" idx_FFTW_THREADS)
list(FIND KOKKOSFFT_TPL_LIST "FFTW_SERIAL" idx_FFTW_SERIAL)

if(idx_CUFFT GREATER -1)
if(${idx_CUFFT} GREATER -1)
find_package(CUDAToolkit REQUIRED COMPONENTS cufft)
target_link_libraries(common INTERFACE CUDA::cufft)
target_compile_definitions(common INTERFACE KOKKOSFFT_ENABLE_TPL_CUFFT)
endif()

if(idx_ROCFFT GREATER -1)
if(${idx_ROCFFT} GREATER -1)
find_package(rocfft REQUIRED)
target_link_libraries(common INTERFACE roc::rocfft)
target_compile_definitions(common INTERFACE KOKKOSFFT_ENABLE_TPL_ROCFFT)
endif()

if(idx_HIPFFT GREATER -1)
if(${idx_HIPFFT} GREATER -1)
find_package(hipfft REQUIRED)
target_link_libraries(common INTERFACE hip::hipfft)
target_compile_definitions(common INTERFACE KOKKOSFFT_ENABLE_TPL_HIPFFT)
endif()

if(idx_ONEMKL GREATER -1)
if(${idx_ONEMKL} GREATER -1)
find_package(MKL REQUIRED COMPONENTS SYCL)
target_link_libraries(common INTERFACE MKL::MKL_SYCL)
target_compile_definitions(common INTERFACE KOKKOSFFT_ENABLE_TPL_ONEMKL)
endif()

if(idx_FFTW_OPENMP GREATER -1)
if(${idx_FFTW_OPENMP} GREATER -1)
find_package(FFTW MODULE REQUIRED)
target_link_libraries(common INTERFACE FFTW::Float FFTW::Double FFTW::FloatOpenMP FFTW::DoubleOpenMP)
target_compile_definitions(common INTERFACE KOKKOSFFT_ENABLE_TPL_FFTW)
elseif(idx_FFTW_THREADS GREATER -1)
elseif(${idx_FFTW_THREADS} GREATER -1)
find_package(FFTW MODULE REQUIRED)
target_link_libraries(common INTERFACE FFTW::Float FFTW::Double FFTW::FloatThreads FFTW::DoubleThreads)
target_compile_definitions(common INTERFACE KOKKOSFFT_ENABLE_TPL_FFTW)
elseif(idx_FFTW_SERIAL GREATER -1)
elseif(${idx_FFTW_SERIAL} GREATER -1)
find_package(FFTW MODULE REQUIRED)
target_link_libraries(common INTERFACE FFTW::Float FFTW::Double)
target_compile_definitions(common INTERFACE KOKKOSFFT_ENABLE_TPL_FFTW)
Expand Down

0 comments on commit b6229d2

Please sign in to comment.