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

Tech demo: switch from FFTW to pocketfft/ducc.fft #287

Closed
wants to merge 30 commits into from
Closed
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7ebbf69
showcase ducc FFT
mreineck Jun 14, 2023
000fb37
forgot to add the actual FINUFFT changes ...
mreineck Jun 14, 2023
4ca29b4
fix for duplicate symbol
mreineck Jun 14, 2023
d310c76
try to adjust CMake system
mreineck Jun 14, 2023
6009afc
one more try
mreineck Jun 14, 2023
f3db8be
fix newly-introduced memory leak; remove fftwPlan
mreineck Jun 14, 2023
7d0ad6e
more FFTW removal
mreineck Jun 15, 2023
6443b2f
skip FFTW installation
mreineck Jun 15, 2023
bbff2ae
try to fix MacOS_clang
mreineck Jun 15, 2023
11e94af
one more try
mreineck Jun 15, 2023
4692202
Merge remote-tracking branch 'origin/master' into switch_fft
mreineck Jun 15, 2023
e2222c8
more cleanup
mreineck Jun 15, 2023
94cf684
remove more unused files
mreineck Jun 15, 2023
dccfd1c
more cleanups
mreineck Jun 16, 2023
92e182d
port bug fix from ducc.fft (irrelevant for finufft, just for consiste…
mreineck Jun 17, 2023
2abae38
re-add -lm for C executables
mreineck Jun 17, 2023
e666d8d
doc cosmetics
mreineck Jun 17, 2023
10eb34e
merge master
mreineck Jun 17, 2023
ed4d7fc
Merge remote-tracking branch 'origin/master' into switch_fft
mreineck Jun 19, 2023
2574fc1
Merge remote-tracking branch 'origin/master' into switch_fft
mreineck Jun 21, 2023
7876bce
merge master branch
mreineck Jun 26, 2023
c215a1f
sync with ducc0 master sources; might improve multithreaded FFT perfo…
mreineck Jun 27, 2023
4e96bf7
merge master
mreineck Jun 30, 2023
6a84236
fix overlooked conflict
mreineck Jun 30, 2023
2959238
fix overlooked conflict
mreineck Jun 30, 2023
7bebbf7
ync with ducc0 sources
mreineck Jun 30, 2023
1768bcb
mostly cosmetic adjustments
mreineck Jun 30, 2023
6c3f9d2
implement partial FFTs
mreineck Jun 30, 2023
8c523ba
merge master and update ducc sources
mreineck Nov 23, 2023
66c725c
cleanup and fix a corner case
mreineck Nov 28, 2023
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
13 changes: 4 additions & 9 deletions .github/workflows/C++.yml
Original file line number Diff line number Diff line change
@@ -18,10 +18,6 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install fftw
run: |
yum install -y fftw3-devel

- name: Compile C++ code
run: |
make spreadtestall
@@ -36,9 +32,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install omp and fftw
- name: Install omp
run: |
brew install libomp fftw
brew install libomp
cp make.inc.macosx_clang make.inc

- name: Compile C++ code
@@ -55,9 +51,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install gcc and fftw
- name: Install gcc
run: |
brew install gcc@10 fftw
brew install gcc@10
cp make.inc.macosx_gcc-10 make.inc

- name: Compile C++ code
@@ -86,7 +82,6 @@ jobs:
diffutils
pacboy: >-
toolchain:p
fftw:p
- name: Compile C++ code
run: |
cp make.inc.windows_msys make.inc
4 changes: 0 additions & 4 deletions .github/workflows/python_build_win.ps1
Original file line number Diff line number Diff line change
@@ -39,10 +39,6 @@ Copy-Item -Path C:\msys64\mingw64\bin\libstdc++-*.dll -Destination ([IO.Path]::C
Copy-Item -Path C:\msys64\mingw64\bin\libgcc_s_seh-*.dll -Destination ([IO.Path]::Combine($unpacked_wheel, 'finufft'))
Copy-Item -Path C:\msys64\mingw64\bin\libgomp-*.dll -Destination ([IO.Path]::Combine($unpacked_wheel, 'finufft'))
Copy-Item -Path C:\msys64\mingw64\bin\libwinpthread-*.dll -Destination ([IO.Path]::Combine($unpacked_wheel, 'finufft'))
Copy-Item -Path C:\msys64\mingw64\bin\libfftw3-*.dll -Destination ([IO.Path]::Combine($unpacked_wheel, 'finufft'))
Copy-Item -Path C:\msys64\mingw64\bin\libfftw3f-*.dll -Destination ([IO.Path]::Combine($unpacked_wheel, 'finufft'))
Copy-Item -Path C:\msys64\mingw64\bin\libfftw3_omp-*.dll -Destination ([IO.Path]::Combine($unpacked_wheel, 'finufft'))
Copy-Item -Path C:\msys64\mingw64\bin\libfftw3f_omp-*.dll -Destination ([IO.Path]::Combine($unpacked_wheel, 'finufft'))
New-Item -Path .\wheelhouse -ItemType Directory -Force
wheel.exe pack $unpacked_wheel -d .\wheelhouse
if (-not $?) {throw "Failed pack wheel"}
10 changes: 3 additions & 7 deletions .github/workflows/python_wheel.yml
Original file line number Diff line number Diff line change
@@ -18,10 +18,6 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install fftw
run: |
yum install -y fftw3-devel

- name: Install ffi
run: |
yum install -y libffi-devel
@@ -44,9 +40,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install gcc and fftw
- name: Install gcc
run: |
brew install gcc fftw
brew install gcc
cp make.inc.macosx_gcc-8 make.inc
echo "FC=gfortran-11" >> make.inc
echo "CC=gcc-11" >> make.inc
@@ -169,7 +165,7 @@ jobs:
- uses: actions/checkout@v2

- name: Install GCC and make
run: C:\msys64\usr\bin\bash.exe -lc "pacman -Sy --noconfirm make mingw-w64-x86_64-toolchain mingw-w64-x86_64-fftw"
run: C:\msys64\usr\bin\bash.exe -lc "pacman -Sy --noconfirm make mingw-w64-x86_64-toolchain"

- name: Build and Test Python 3.8
uses: actions/setup-python@v2
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ addons:
homebrew:
packages:
- ccache
- fftw
- libomp
update: true
cache: ccache
33 changes: 12 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.19)

project(finufft VERSION 2.2.0 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CUDA_STANDARD 17)

set(GNU_LIKE_FRONTENDS AppleClang Clang GNU)
if(CMAKE_CXX_COMPILER_ID IN_LIST GNU_LIKE_FRONTENDS)
# Set custom compiler flags for gcc-compatible compilers
@@ -27,17 +30,14 @@ option(FINUFFT_BUILD_TESTS "Whether to build the FINUFFT tests" OFF)
option(FINUFFT_BUILD_FORTRAN "Whether to build the FINUFFT Fortran examples" OFF)
option(FINUFFT_BUILD_MATLAB "Whether to build the FINUFFT Matlab interface" OFF)
option(FINUFFT_ENABLE_SANITIZERS "Whether to enable sanitizers, only effective for Debug configuration." ON)
option(FINUFFT_USE_OPENMP "Whether to use OpenMP for parallelization. If disabled, the finufft library will be single threaded. This does not affect the choice of FFTW library." ON)
option(FINUFFT_USE_OPENMP "Whether to use OpenMP for parallelization. If disabled, the finufft library will be single threaded." ON)
option(FINUFFT_USE_CUDA "Whether to build CUDA accelerated FINUFFT library (libcufinufft). This is completely independent of the main FINUFFT library" OFF)
option(FINUFFT_USE_CPU "Whether to build the ordinary FINUFFT library (libfinufft)." ON)
# sphinx tag (don't remove): @cmake_opts_end

if(FINUFFT_USE_CPU)
set(CPM_DOWNLOAD_VERSION 0.38.0)
include(cmake/setupCPM.cmake)

set(FFTW_VERSION 3.3.10)
include(cmake/setupFFTW.cmake)
endif()

if (FINUFFT_BUILD_MATLAB)
@@ -87,7 +87,8 @@ endfunction()
# Utility function to set finufft compilation options.
function(set_finufft_options target)
set_property(TARGET ${target} PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET ${target} PROPERTY CMAKE_CXX_STANDARD 14)
set_property(TARGET ${target} PROPERTY CMAKE_CXX_STANDARD 17)
set_property(TARGET ${target} PROPERTY CMAKE_CUDA_STANDARD 17)
enable_asan(${target})

target_compile_options(${target} PRIVATE SHELL:$<$<CONFIG:Release,RelWithDebInfo>:${FINUFFT_ARCH_FLAGS}>)
@@ -96,7 +97,7 @@ function(set_finufft_options target)
target_compile_options(${target} PRIVATE $<$<CONFIG:Release,RelWithDebInfo>:-fcx-limited-range>)
endif ()

target_include_directories(${target} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_include_directories(${target} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/contrib")
if (FINUFFT_USE_OPENMP)
target_link_libraries(${target} PRIVATE OpenMP::OpenMP_CXX)
# there are issues on windows with OpenMP and CMake, so we need to manually add the flags
@@ -111,31 +112,20 @@ function(set_finufft_options target)
endif ()
endif ()

# FFTW CMAKE file includes the APIs only as an install target, so we need to manually
# include them since we need them for build not for install
# trying to include them directly into the fftw and fftwf targets causes issues with
# the latest version of cmake, so we do it here instead.
if ( (NOT FFTW_FOUND ) OR (FINUFFT_FFTW_LIBRARIES STREQUAL DOWNLOAD))
list (GET FINUFFT_FFTW_LIBRARIES 0 element)
get_property(FFTW_SOURCE_DIR TARGET ${element} PROPERTY SOURCE_DIR)
set(FFTW_INCLUDE_DIR ${FFTW_SOURCE_DIR}/api)
target_include_directories(${target} PUBLIC ${FFTW_INCLUDE_DIR})
endif()

endfunction()

if(FINUFFT_USE_CPU)
# Main finufft libraries
add_library(finufft_f32 OBJECT ${FINUFFT_PRECISION_DEPENDENT_SOURCES})
target_compile_definitions(finufft_f32 PRIVATE SINGLE)
set_finufft_options(finufft_f32)
target_link_libraries(finufft_f32 PUBLIC ${FINUFFT_FFTW_LIBRARIES})
target_link_libraries(finufft_f32 PUBLIC)

add_library(finufft_f64 OBJECT ${FINUFFT_PRECISION_DEPENDENT_SOURCES})
set_finufft_options(finufft_f64)
target_link_libraries(finufft_f64 PUBLIC ${FINUFFT_FFTW_LIBRARIES})
target_link_libraries(finufft_f64 PUBLIC)

add_library(finufft SHARED src/utils_precindep.cpp contrib/legendre_rule_fast.cpp)
add_library(finufft SHARED src/utils_precindep.cpp contrib/legendre_rule_fast.cpp contrib/ducc0/infra/string_utils.cc contrib/ducc0/infra/threading.cc)
set_finufft_options(finufft)
target_link_libraries(finufft PUBLIC finufft_f32 finufft_f64)
# windows does not have a math library, so we need to exclude it
@@ -144,7 +134,7 @@ if(FINUFFT_USE_CPU)
endif()
target_include_directories(finufft PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")

add_library(finufft_static STATIC src/utils_precindep.cpp contrib/legendre_rule_fast.cpp)
add_library(finufft_static STATIC src/utils_precindep.cpp contrib/legendre_rule_fast.cpp contrib/ducc0/infra/string_utils.cc contrib/ducc0/infra/threading.cc)
set_finufft_options(finufft)
target_link_libraries(finufft_static PUBLIC finufft_f32 finufft_f64)
# windows does not have a math library, so we need to exclude it
@@ -161,6 +151,7 @@ if(FINUFFT_USE_CUDA)
set(CMAKE_CUDA_ARCHITECTURES "60;70;75" CACHE STRING "" FORCE)
endif()
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 17)
find_package(CUDAToolkit REQUIRED)
add_subdirectory(src/cuda)
if (BUILD_TESTING AND FINUFFT_BUILD_TESTS)
4 changes: 1 addition & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -48,10 +48,9 @@
"name": "singlethreaded",
"binaryDir": "build/singlethreaded",
"displayName": "singlethreaded",
"description": "Configuration for single-threaded build. Disables OpenMP for finufft and FFTW",
"description": "Configuration for single-threaded build. Disables OpenMP for finufft and FFT",
"inherits": "default",
"cacheVariables": {
"FINUFFT_FFTW_SUFFIX": "",
"FINUFFT_USE_OPENMP": "OFF"
}
},
@@ -89,7 +88,6 @@
"description": "Build with the matlab interface",
"generator": "Ninja Multi-Config",
"cacheVariables": {
"FINUFFT_FFTW_SUFFIX": "Threads",
"FINUFFT_BUILD_MATLAB": "ON",
"FINUFFT_ENABLE_SANITIZERS": "OFF"
}
62 changes: 0 additions & 62 deletions cmake/setupFFTW.cmake

This file was deleted.

Loading