Skip to content

Commit

Permalink
Rebase on KokkosFFT
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Oct 4, 2024
1 parent 2e8e3ed commit 839aa84
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 944 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ jobs:
export benchmark_ROOT=$PWD/opt/benchmark
export GTest_ROOT=$PWD/opt/gtest
export Kokkos_ROOT=$PWD/opt/kokkos
export KokkosFFT_ROOT=$PWD/opt/kokkos-fft
export KokkosKernels_ROOT=$PWD/opt/kokkos-kernels
cmake \
Expand Down Expand Up @@ -196,6 +197,16 @@ jobs:
cmake --install build --prefix $Kokkos_ROOT
rm -rf build
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-DKokkosFFT_ENABLE_HOST_AND_DEVICE=ON \
-B build \
-S /src/vendor/kokkos-fft
cmake --build build --parallel 2
cmake --install build --prefix $KokkosFFT_ROOT
rm -rf build
cmake \
-DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
Expand Down Expand Up @@ -223,6 +234,7 @@ jobs:
-DDDC_benchmark_DEPENDENCY_POLICY=INSTALLED \
-DDDC_GTest_DEPENDENCY_POLICY=INSTALLED \
-DDDC_Kokkos_DEPENDENCY_POLICY=INSTALLED \
-DDDC_KokkosFFT_DEPENDENCY_POLICY=INSTALLED \
-B build \
-S /src
cmake --build build --parallel 2
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
[submodule "vendor/doxygen-awesome-css"]
path = vendor/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
[submodule "vendor/kokkos-fft"]
path = vendor/kokkos-fft
url = https://github.com/kokkos/kokkos-fft.git
55 changes: 19 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ endif()
# Custom cmake modules
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )

# FFTW
if("${DDC_BUILD_KERNELS_FFT}" AND NOT FFTW_FOUND)
find_package( FFTW MODULE REQUIRED )
endif()

## CUDA + CUDAToolkit
if("${DDC_BUILD_KERNELS_FFT}" AND "${Kokkos_ENABLE_CUDA}")
find_package( CUDAToolkit MODULE REQUIRED )
if( NOT(CUDAToolkit_FOUND) )
message(FATAL_ERROR "CUDAToolkit not found." )
endif()
endif()


## PDI

Expand Down Expand Up @@ -179,30 +166,26 @@ install(

# Link library to DDC

if( FFTW_FOUND )
target_link_libraries( DDC INTERFACE FFTW::Float )
target_link_libraries( DDC INTERFACE FFTW::Double )
endif()

if( FFTW_FOUND AND "${Kokkos_ENABLE_SERIAL}")
target_compile_definitions(DDC INTERFACE fftw_serial_AVAIL)
endif()

if( FFTW_FOUND AND "${Kokkos_ENABLE_OPENMP}")
target_link_libraries( DDC INTERFACE FFTW::FloatOpenMP )
target_link_libraries( DDC INTERFACE FFTW::DoubleOpenMP )
target_compile_definitions(DDC INTERFACE fftw_omp_AVAIL)
endif()

if( CUDAToolkit_FOUND AND "${Kokkos_ENABLE_CUDA}")
target_link_libraries( DDC INTERFACE CUDA::cufft )
target_compile_definitions(DDC INTERFACE cufft_AVAIL)
endif()
if("${DDC_BUILD_KERNELS_FFT}")
# Kokkos-fft
set(DDC_KokkosFFT_DEPENDENCY_POLICY "AUTO" CACHE STRING "Policy to find the `Kokkos-fft` package. Options: ${DDC_DEPENDENCY_POLICIES}")
set_property(CACHE DDC_KokkosFFT_DEPENDENCY_POLICY PROPERTY STRINGS "${DDC_DEPENDENCY_POLICIES}")
if("${DDC_KokkosFFT_DEPENDENCY_POLICY}" STREQUAL "AUTO")
if(NOT TARGET KokkosFFT::fft)
find_package(KokkosFFT CONFIG QUIET)
if(NOT KokkosFFT_FOUND)
option(KokkosFFT_ENABLE_HOST_AND_DEVICE "Enable FFT on both host and device" ON)
add_subdirectory(vendor/kokkos-fft)
endif()
endif()
elseif("${DDC_KokkosFFT_DEPENDENCY_POLICY}" STREQUAL "EMBEDDED")
option(KokkosFFT_ENABLE_HOST_AND_DEVICE "Enable FFT on both host and device" ON)
add_subdirectory(vendor/kokkos-fft)
elseif("${DDC_KokkosFFT_DEPENDENCY_POLICY}" STREQUAL "INSTALLED")
find_package(KokkosFFT CONFIG REQUIRED)
endif()

if("${Kokkos_ENABLE_HIP}")
find_package( hipfft REQUIRED ) # Not compatible with nvidia
target_link_libraries( DDC INTERFACE hip::hipfft )
target_compile_definitions(DDC INTERFACE hipfft_AVAIL)
target_link_libraries(DDC INTERFACE KokkosFFT::fft)
endif()

if("${DDC_BUILD_KERNELS_SPLINES}")
Expand Down
11 changes: 0 additions & 11 deletions LICENSES/BSD-3-Clause.txt

This file was deleted.

4 changes: 4 additions & 0 deletions cmake/DDCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

include(CMakeFindDependencyMacro)

if(@DDC_BUILD_KERNELS_FFT@)
find_dependency(KokkosFFT)
endif()

if(@DDC_BUILD_PDI_WRAPPER@)
find_dependency(PDI COMPONENTS C)
endif()
Expand Down
Loading

0 comments on commit 839aa84

Please sign in to comment.