finufft 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. finufft-2.3.0/CMakeLists.txt +397 -0
  2. finufft-2.3.0/LICENSE +50 -0
  3. finufft-2.3.0/PKG-INFO +81 -0
  4. finufft-2.3.0/README.md +65 -0
  5. finufft-2.3.0/cmake/CheckAVX.cpp +48 -0
  6. finufft-2.3.0/cmake/setupCPM.cmake +21 -0
  7. finufft-2.3.0/cmake/setupDUCC.cmake +46 -0
  8. finufft-2.3.0/cmake/setupFFTW.cmake +87 -0
  9. finufft-2.3.0/cmake/setupSphinx.cmake +21 -0
  10. finufft-2.3.0/cmake/setupXSIMD.cmake +28 -0
  11. finufft-2.3.0/cmake/utils.cmake +89 -0
  12. finufft-2.3.0/contrib/legendre_rule_fast.cpp +490 -0
  13. finufft-2.3.0/contrib/legendre_rule_fast.h +10 -0
  14. finufft-2.3.0/contrib/legendre_rule_fast.license +8 -0
  15. finufft-2.3.0/include/finufft/defs.h +260 -0
  16. finufft-2.3.0/include/finufft/dirft.h +22 -0
  17. finufft-2.3.0/include/finufft/fft.h +18 -0
  18. finufft-2.3.0/include/finufft/fftw_defs.h +48 -0
  19. finufft-2.3.0/include/finufft/spreadinterp.h +63 -0
  20. finufft-2.3.0/include/finufft/test_defs.h +32 -0
  21. finufft-2.3.0/include/finufft/utils.h +25 -0
  22. finufft-2.3.0/include/finufft/utils_precindep.h +44 -0
  23. finufft-2.3.0/include/finufft.fh +11 -0
  24. finufft-2.3.0/include/finufft.h +52 -0
  25. finufft-2.3.0/include/finufft_eitherprec.h +186 -0
  26. finufft-2.3.0/include/finufft_errors.h +26 -0
  27. finufft-2.3.0/include/finufft_mod.f90 +17 -0
  28. finufft-2.3.0/include/finufft_opts.h +57 -0
  29. finufft-2.3.0/include/finufft_spread_opts.h +34 -0
  30. finufft-2.3.0/pyproject.toml +110 -0
  31. finufft-2.3.0/python/CMakeLists.txt +11 -0
  32. finufft-2.3.0/python/finufft/README.md +13 -0
  33. finufft-2.3.0/python/finufft/finufft/__init__.py +20 -0
  34. finufft-2.3.0/python/finufft/finufft/_finufft.py +141 -0
  35. finufft-2.3.0/python/finufft/finufft/_interfaces.py +856 -0
  36. finufft-2.3.0/python/finufft/requirements.txt +1 -0
  37. finufft-2.3.0/src/fft.cpp +115 -0
  38. finufft-2.3.0/src/finufft.cpp +1251 -0
  39. finufft-2.3.0/src/ker_horner_allw_loop_constexpr.h +711 -0
  40. finufft-2.3.0/src/ker_lowupsampfac_horner_allw_loop_constexpr.h +576 -0
  41. finufft-2.3.0/src/simpleinterfaces.cpp +291 -0
  42. finufft-2.3.0/src/spreadinterp.cpp +2300 -0
  43. finufft-2.3.0/src/utils.cpp +86 -0
  44. finufft-2.3.0/src/utils_precindep.cpp +90 -0
@@ -0,0 +1,397 @@
1
+ cmake_minimum_required(VERSION 3.19...3.30)
2
+ project(
3
+ FINUFFT
4
+ VERSION 2.3.0
5
+ LANGUAGES C CXX)
6
+
7
+ # windows MSVC runtime flags policy
8
+ cmake_policy(SET CMP0091 NEW)
9
+
10
+ include(CMakeDependentOption)
11
+
12
+ # cmake-format: off
13
+ # All options go here sphinx tag (don't remove): @cmake_opts_start
14
+ option(FINUFFT_BUILD_FORTRAN "Whether to build the FINUFFT Fortran examples" OFF)
15
+ option(FINUFFT_BUILD_MATLAB "Whether to build the FINUFFT Matlab interface" OFF)
16
+ option(FINUFFT_BUILD_PYTHON "Whether the Python wrapper should be built." OFF)
17
+ option(FINUFFT_ENABLE_SANITIZERS "Whether to enable sanitizers, only effective for Debug configuration." OFF)
18
+ 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)
19
+ option(FINUFFT_USE_CPU "Whether to build the ordinary FINUFFT library (libfinufft)." ON)
20
+ option(FINUFFT_USE_CUDA "Whether to build CUDA accelerated FINUFFT library (libcufinufft). This is completely independent of the main FINUFFT library" OFF)
21
+ option(FINUFFT_STATIC_LINKING "If ON builds the static finufft library, if OFF build a shared finufft library." ON)
22
+ option(FINUFFT_POSITION_INDEPENDENT_CODE "Whether to build the finufft library with position independent code (-fPIC). This forced ON when FINUFFT_SHARED_LINKING is ON." ON)
23
+ option(FINUFFT_BUILD_DEVEL "Whether to build development executables" OFF)
24
+ option(FINUFFT_BUILD_EXAMPLES "Whether to build the FINUFFT examples" OFF)
25
+ option(FINUFFT_BUILD_TESTS "Whether to build the FINUFFT tests" OFF)
26
+ option(FINUFFT_USE_DUCC0 "Whether to use DUCC0 (instead of FFTW) for CPU FFTs" OFF)
27
+ option(FINUFFT_BUILD_DOCS "Whether to build the FINUFFT documentation" OFF)
28
+ # if FINUFFT_USE_DUCC0 is ON, the following options are ignored
29
+ set(FINUFFT_FFTW_LIBRARIES "DEFAULT" CACHE STRING "Specify a custom FFTW library")
30
+ set(FINUFFT_FFTW_SUFFIX "OpenMP" CACHE STRING "Suffix for FFTW libraries (e.g. OpenMP, Threads etc.)")
31
+ # if FINUFFT_USE_CUDA is OFF, the following options are ignored
32
+ set(FINUFFT_CUDA_ARCHITECTURES "native" CACHE STRING "CUDA architectures to build for (e.g. 60;70;75;)")
33
+ # if FINUFFT_USE_CPU is OFF, the following options are ignored
34
+ set(FINUFFT_ARCH_FLAGS "native" CACHE STRING "Compiler flags for specifying target architecture, defaults to -march=native")
35
+ # sphinx tag (don't remove): @cmake_opts_end
36
+ cmake_dependent_option(FINUFFT_ENABLE_INSTALL "Disable installation in the case of python builds" ON "NOT FINUFFT_BUILD_PYTHON" OFF)
37
+ cmake_dependent_option(FINUFFT_STATIC_LINKING "Disable static libraries in the case of python builds" ON "NOT FINUFFT_BUILD_PYTHON" OFF)
38
+ cmake_dependent_option(FINUFFT_SHARED_LINKING "Shared should be the opposite of static linking" ON "NOT FINUFFT_STATIC_LINKING" OFF)
39
+ # cmake-format: on
40
+
41
+ # When building shared libraries, we need to build with -fPIC in all cases
42
+ if(FINUFFT_SHARED_LINKING)
43
+ set(FINUFFT_POSITION_INDEPENDENT_CODE ON)
44
+ endif()
45
+
46
+ include(cmake/utils.cmake)
47
+
48
+ set(FINUFFT_CXX_FLAGS_RELEASE
49
+ -funroll-loops
50
+ -ffp-contract=fast
51
+ -fno-math-errno
52
+ -fno-signed-zeros
53
+ -fno-trapping-math
54
+ -fassociative-math
55
+ -freciprocal-math
56
+ -fmerge-all-constants
57
+ -ftree-vectorize
58
+ -fimplicit-constexpr
59
+ -fcx-limited-range
60
+ -O3
61
+ /Ox
62
+ /fp:contract
63
+ /fp:except-
64
+ /GF
65
+ /GY
66
+ /GS-
67
+ /Ob
68
+ /Oi
69
+ /Ot
70
+ /Oy)
71
+
72
+ filter_supported_compiler_flags(FINUFFT_CXX_FLAGS_RELEASE
73
+ FINUFFT_CXX_FLAGS_RELEASE)
74
+ message(STATUS "FINUFFT Release flags: ${FINUFFT_CXX_FLAGS_RELEASE}")
75
+ set(FINUFFT_CXX_FLAGS_RELWITHDEBINFO ${FINUFFT_CXX_FLAGS_RELEASE})
76
+
77
+ set(FINUFFT_CXX_FLAGS_DEBUG
78
+ -g
79
+ -g3
80
+ -ggdb
81
+ -ggdb3
82
+ /Zi
83
+ -Wall
84
+ -Wno-sign-compare
85
+ -Wno-unknown-pragmas)
86
+ filter_supported_compiler_flags(FINUFFT_CXX_FLAGS_DEBUG FINUFFT_CXX_FLAGS_DEBUG)
87
+ message(STATUS "FINUFFT Debug flags: ${FINUFFT_CXX_FLAGS_DEBUG}")
88
+ list(APPEND FINUFFT_CXX_FLAGS_RELWITHDEBINFO ${FINUFFT_CXX_FLAGS_RELEASE}
89
+ ${FINUFFT_CXX_FLAGS_DEBUG})
90
+ message(
91
+ STATUS "FINUFFT RelWithDebInfo flags: ${FINUFFT_CXX_FLAGS_RELWITHDEBINFO}")
92
+
93
+ if(FINUFFT_ARCH_FLAGS STREQUAL "native")
94
+ set(FINUFFT_ARCH_FLAGS
95
+ -march=native
96
+ CACHE STRING "" FORCE)
97
+ filter_supported_compiler_flags(FINUFFT_ARCH_FLAGS FINUFFT_ARCH_FLAGS)
98
+ if(NOT FINUFFT_ARCH_FLAGS)
99
+ set(FINUFFT_ARCH_FLAGS
100
+ -mtune=native
101
+ CACHE STRING "" FORCE)
102
+ filter_supported_compiler_flags(FINUFFT_ARCH_FLAGS FINUFFT_ARCH_FLAGS)
103
+ endif()
104
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
105
+ # -march=native emulation for MSVC
106
+ check_arch_support()
107
+ endif()
108
+ if(NOT FINUFFT_ARCH_FLAGS)
109
+ message(WARNING "No architecture flags are supported by the compiler.")
110
+ else()
111
+ message(STATUS "FINUFFT Arch flags: ${FINUFFT_ARCH_FLAGS}")
112
+ endif()
113
+ endif()
114
+
115
+ # Set default build type to Release
116
+ if(NOT CMAKE_BUILD_TYPE)
117
+ set(CMAKE_BUILD_TYPE
118
+ Release
119
+ CACHE STRING "Set the default build type to Release" FORCE)
120
+ endif()
121
+
122
+ # This set of sources is compiled twice, once in single precision and once in
123
+ # double precision The single precision compilation is done with -DSINGLE
124
+ set(FINUFFT_PRECISION_DEPENDENT_SOURCES
125
+ src/finufft.cpp src/fft.cpp src/simpleinterfaces.cpp src/spreadinterp.cpp
126
+ src/utils.cpp)
127
+
128
+ # If we're building for Fortran, make sure we also include the translation
129
+ # layer.
130
+ if(FINUFFT_BUILD_FORTRAN)
131
+ list(APPEND FINUFFT_PRECISION_DEPENDENT_SOURCES fortran/finufftfort.cpp)
132
+ endif()
133
+
134
+ # set linker flags for sanitizer
135
+ set(FINUFFT_SANITIZER_FLAGS)
136
+ if(FINUFFT_ENABLE_SANITIZERS)
137
+ set(FINUFFT_SANITIZER_FLAGS -fsanitize=address -fsanitize=undefined
138
+ -fsanitize=bounds-strict /fsanitize=address /RTC1)
139
+ filter_supported_compiler_flags(FINUFFT_SANITIZER_FLAGS
140
+ FINUFFT_SANITIZER_FLAGS)
141
+ set(FINUFFT_SANITIZER_FLAGS
142
+ $<$<CONFIG:Debug,RelWithDebInfo>:${FINUFFT_SANITIZER_FLAGS}>)
143
+ endif()
144
+ # Utility function to enable ASAN on debug builds
145
+ function(enable_asan target)
146
+ target_compile_options(${target} PRIVATE ${FINUFFT_SANITIZER_FLAGS})
147
+ if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"))
148
+ target_link_options(${target} PRIVATE ${FINUFFT_SANITIZER_FLAGS})
149
+ endif()
150
+ endfunction()
151
+
152
+ set(CPM_DOWNLOAD_VERSION 0.40.2)
153
+ include(cmake/setupCPM.cmake)
154
+
155
+ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
156
+ include(CTest)
157
+ if(FINUFFT_BUILD_TESTS)
158
+ enable_testing()
159
+ endif()
160
+ if(FINUFFT_BUILD_DOCS)
161
+ include(cmake/setupSphinx.cmake)
162
+ endif()
163
+ endif()
164
+
165
+ if(FINUFFT_USE_CPU)
166
+ # make apple with gnu use old linker, new linker breaks, see issue #360
167
+ if((APPLE) AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
168
+ add_link_options("-ld_classic")
169
+ endif()
170
+ set(FFTW_VERSION 3.3.10)
171
+ set(XTL_VERSION 0.7.7)
172
+ set(XSIMD_VERSION 13.0.0)
173
+ # using latest ducc0 version for now as it fixes MacOS GCC build
174
+ set(DUCC0_VERSION b0beb85e03982344a31ebb119758d7aa3ef5d362)
175
+ set(FINUFFT_FFTW_LIBRARIES)
176
+ include(cmake/setupXSIMD.cmake)
177
+ if(FINUFFT_USE_DUCC0)
178
+ include(cmake/setupDUCC.cmake)
179
+ else()
180
+ include(cmake/setupFFTW.cmake)
181
+ endif()
182
+ if(FINUFFT_USE_DUCC0)
183
+ set(FINUFFT_FFTLIBS ducc0)
184
+ else()
185
+ set(FINUFFT_FFTLIBS ${FINUFFT_FFTW_LIBRARIES})
186
+ endif()
187
+ if(FINUFFT_USE_OPENMP)
188
+ find_package(
189
+ OpenMP
190
+ COMPONENTS C CXX
191
+ REQUIRED)
192
+ endif()
193
+ endif()
194
+
195
+ # check if -Wno-deprecated-declarations is supported
196
+ check_cxx_compiler_flag(-Wno-deprecated-declarations
197
+ FINUFFT_HAS_NO_DEPRECATED_DECLARATIONS)
198
+
199
+ # Utility function to link static/dynamic lib
200
+ function(finufft_link_test target)
201
+ if(FINUFFT_USE_DUCC0)
202
+ target_compile_definitions(${target} PRIVATE FINUFFT_USE_DUCC0)
203
+ endif()
204
+ target_link_libraries(${target} PRIVATE finufft ${FINUFFT_FFTLIBS})
205
+ if(FINUFFT_USE_OPENMP)
206
+ target_link_libraries(${target} PRIVATE OpenMP::OpenMP_CXX)
207
+ target_link_options(${target} PRIVATE ${OpenMP_CXX_FLAGS})
208
+ endif()
209
+ enable_asan(${target})
210
+ target_compile_features(${target} PRIVATE cxx_std_17)
211
+ set_target_properties(
212
+ ${target} PROPERTIES MSVC_RUNTIME_LIBRARY
213
+ "MultiThreaded$<$<CONFIG:Debug>:Debug>")
214
+ # disable deprecated warnings for tests if supported
215
+ if(FINUFFT_HAS_NO_DEPRECATED_DECLARATIONS)
216
+ target_compile_options(${target} PRIVATE -Wno-deprecated-declarations)
217
+ endif()
218
+ endfunction()
219
+
220
+ # Utility function to set finufft compilation options.
221
+ function(set_finufft_options target)
222
+ target_compile_features(${target} PRIVATE cxx_std_17)
223
+ target_compile_options(
224
+ ${target} PRIVATE $<$<CONFIG:Release,RelWithDebInfo>:${FINUFFT_ARCH_FLAGS}>)
225
+ target_compile_options(
226
+ ${target} PRIVATE $<$<CONFIG:Release>:${FINUFFT_CXX_FLAGS_RELEASE}>)
227
+ target_compile_options(
228
+ ${target}
229
+ PRIVATE $<$<CONFIG:RelWithDebInfo>:${FINUFFT_CXX_FLAGS_RELWITHDEBINFO}>)
230
+ target_compile_options(${target}
231
+ PRIVATE $<$<CONFIG:Debug>:${FINUFFT_CXX_FLAGS_DEBUG}>)
232
+ target_include_directories(
233
+ ${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
234
+ target_include_directories(
235
+ ${target} SYSTEM
236
+ INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
237
+ set_target_properties(
238
+ ${target}
239
+ PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
240
+ POSITION_INDEPENDENT_CODE ${FINUFFT_POSITION_INDEPENDENT_CODE})
241
+ enable_asan(${target})
242
+ if(FINUFFT_USE_OPENMP)
243
+ target_link_libraries(${target} PRIVATE OpenMP::OpenMP_CXX)
244
+ target_link_options(${target} PRIVATE ${OpenMP_CXX_FLAGS})
245
+ endif()
246
+ if(FINUFFT_USE_DUCC0)
247
+ target_compile_definitions(${target} PRIVATE FINUFFT_USE_DUCC0)
248
+ endif()
249
+ target_link_libraries(${target} PRIVATE xsimd)
250
+ target_link_libraries(${target} PRIVATE ${FINUFFT_FFTLIBS})
251
+ endfunction()
252
+
253
+ if(FINUFFT_USE_CPU)
254
+ # Main finufft libraries
255
+ add_library(finufft_f32 OBJECT ${FINUFFT_PRECISION_DEPENDENT_SOURCES})
256
+ target_compile_definitions(finufft_f32 PRIVATE SINGLE)
257
+ set_finufft_options(finufft_f32)
258
+
259
+ add_library(finufft_f64 OBJECT ${FINUFFT_PRECISION_DEPENDENT_SOURCES})
260
+ set_finufft_options(finufft_f64)
261
+ if(NOT FINUFFT_STATIC_LINKING)
262
+ add_library(finufft SHARED src/utils_precindep.cpp
263
+ contrib/legendre_rule_fast.cpp)
264
+ else()
265
+ add_library(finufft STATIC src/utils_precindep.cpp
266
+ contrib/legendre_rule_fast.cpp)
267
+ endif()
268
+ target_link_libraries(finufft PRIVATE finufft_f32 finufft_f64)
269
+ set_finufft_options(finufft)
270
+
271
+ if(WIN32 AND FINUFFT_SHARED_LINKING)
272
+ target_compile_definitions(finufft_f32 PRIVATE dll_EXPORTS FINUFFT_DLL)
273
+ target_compile_definitions(finufft_f64 PRIVATE dll_EXPORTS FINUFFT_DLL)
274
+ target_compile_definitions(finufft PRIVATE dll_EXPORTS FINUFFT_DLL)
275
+ endif()
276
+ find_library(MATH_LIBRARY m)
277
+ if(MATH_LIBRARY)
278
+ target_link_libraries(finufft PRIVATE ${MATH_LIBRARY})
279
+ endif()
280
+ target_include_directories(
281
+ finufft PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
282
+ target_include_directories(
283
+ finufft SYSTEM
284
+ INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
285
+ if(FINUFFT_ENABLE_INSTALL)
286
+ file(GLOB FINUFFT_PUBLIC_HEADERS
287
+ "${CMAKE_CURRENT_SOURCE_DIR}/include/finufft*.h")
288
+ set_target_properties(finufft PROPERTIES PUBLIC_HEADER
289
+ "${FINUFFT_PUBLIC_HEADERS}")
290
+ endif()
291
+ list(APPEND INSTALL_TARGETS finufft)
292
+ endif()
293
+
294
+ if(FINUFFT_USE_CUDA)
295
+ if(NOT DEFINED FINUFFT_CUDA_ARCHITECTURES)
296
+ if(DEFINED CMAKE_CUDA_ARCHITECTURES)
297
+ set(FINUFFT_CUDA_ARCHITECTURES "{$CMAKE_CUDA_ARCHITECTURES}")
298
+ else()
299
+ message(
300
+ "FINUFFT WARNING: No CUDA architecture supplied via '-DFINUFFT_CUDA_ARCHITECTURES=...', defaulting to 'native'"
301
+ )
302
+ message(
303
+ "See: https://developer.nvidia.com/cuda-gpus for more details on what architecture to supply."
304
+ )
305
+ endif()
306
+ endif()
307
+ enable_language(CUDA)
308
+ find_package(CUDAToolkit REQUIRED)
309
+ add_subdirectory(src/cuda)
310
+ if(BUILD_TESTING AND FINUFFT_BUILD_TESTS)
311
+ add_subdirectory(perftest/cuda)
312
+ add_subdirectory(test/cuda)
313
+ endif()
314
+
315
+ list(APPEND INSTALL_TARGETS cufinufft)
316
+ endif()
317
+
318
+ # Add tests defined in their own directory
319
+ if(BUILD_TESTING
320
+ AND FINUFFT_USE_CPU
321
+ AND FINUFFT_BUILD_TESTS)
322
+ add_subdirectory(test)
323
+ add_subdirectory(perftest)
324
+ endif()
325
+
326
+ if(FINUFFT_BUILD_EXAMPLES AND FINUFFT_USE_CPU)
327
+ add_subdirectory(examples)
328
+ endif()
329
+
330
+ if(FINUFFT_BUILD_EXAMPLES AND FINUFFT_USE_CUDA)
331
+ add_subdirectory(examples/cuda)
332
+ endif()
333
+
334
+ if(FINUFFT_BUILD_FORTRAN)
335
+ enable_language(Fortran)
336
+ add_subdirectory(fortran)
337
+ endif()
338
+
339
+ if(FINUFFT_BUILD_MATLAB)
340
+ add_subdirectory(matlab)
341
+ endif()
342
+
343
+ if(FINUFFT_BUILD_DEVEL)
344
+ add_subdirectory(devel)
345
+ endif()
346
+
347
+ if(FINUFFT_BUILD_PYTHON)
348
+ add_subdirectory(python)
349
+ endif()
350
+
351
+ # cmake-format: off
352
+ message(STATUS "FINUFFT configuration summary:")
353
+ message(STATUS " CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
354
+ message(STATUS " FINUFFT_USE_CPU: ${FINUFFT_USE_CPU}")
355
+ message(STATUS " FINUFFT_USE_CUDA: ${FINUFFT_USE_CUDA}")
356
+ message(STATUS " FINUFFT_USE_OPENMP: ${FINUFFT_USE_OPENMP}")
357
+ message(STATUS " FINUFFT_STATIC_LINKING: ${FINUFFT_STATIC_LINKING}")
358
+ message(STATUS " FINUFFT_POSITION_INDEPENDENT_CODE: ${FINUFFT_POSITION_INDEPENDENT_CODE}")
359
+ message(STATUS " FINUFFT_ENABLE_INSTALL: ${FINUFFT_ENABLE_INSTALL}")
360
+ message(STATUS " FINUFFT_BUILD_EXAMPLES: ${FINUFFT_BUILD_EXAMPLES}")
361
+ message(STATUS " FINUFFT_BUILD_TESTS: ${FINUFFT_BUILD_TESTS}")
362
+ message(STATUS " FINUFFT_BUILD_FORTRAN: ${FINUFFT_BUILD_FORTRAN}")
363
+ message(STATUS " FINUFFT_BUILD_MATLAB: ${FINUFFT_BUILD_MATLAB}")
364
+ message(STATUS " FINUFFT_BUILD_PYTHON: ${FINUFFT_BUILD_PYTHON}")
365
+ message(STATUS " FINUFFT_ENABLE_SANITIZERS: ${FINUFFT_ENABLE_SANITIZERS}")
366
+ message(STATUS " FINUFFT_FFTW_SUFFIX: ${FINUFFT_FFTW_SUFFIX}")
367
+ message(STATUS " FINUFFT_FFTW_LIBRARIES: ${FINUFFT_FFTW_LIBRARIES}")
368
+ message(STATUS " FINUFFT_ARCH_FLAGS: ${FINUFFT_ARCH_FLAGS}")
369
+ message(STATUS " FINUFFT_USE_DUCC0: ${FINUFFT_USE_DUCC0}")
370
+ # cmake-format: on
371
+ if(FINUFFT_ENABLE_INSTALL)
372
+ include(GNUInstallDirs)
373
+ install(TARGETS ${INSTALL_TARGETS} PUBLIC_HEADER)
374
+ install(FILES ${PROJECT_SOURCE_DIR}/LICENSE
375
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/licenses/finufft)
376
+ if(FINUFFT_USE_CPU)
377
+ install(
378
+ DIRECTORY ${PROJECT_SOURCE_DIR}/examples
379
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/finufft
380
+ PATTERN "CMakeLists.txt" EXCLUDE
381
+ PATTERN "README" EXCLUDE
382
+ PATTERN "examples/cuda" EXCLUDE)
383
+ if(FINUFFT_BUILD_FORTRAN)
384
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/fortran/examples
385
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/finufft/fortran)
386
+ install(FILES ${PROJECT_SOURCE_DIR}/include/finufft.fh
387
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
388
+ endif()
389
+ endif()
390
+ if(FINUFFT_USE_CUDA)
391
+ install(
392
+ DIRECTORY ${PROJECT_SOURCE_DIR}/examples/cuda
393
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/finufft/examples
394
+ PATTERN "README" EXCLUDE
395
+ PATTERN "CMakeLists.txt" EXCLUDE)
396
+ endif()
397
+ endif()
finufft-2.3.0/LICENSE ADDED
@@ -0,0 +1,50 @@
1
+ Copyright (C) 2017-2024 The Simons Foundation, Inc. - All Rights Reserved.
2
+
3
+ See docs/ackn.rst for the list of code authors and contributors.
4
+
5
+ ------
6
+
7
+ FINUFFT is licensed under the Apache License, Version 2.0 (the
8
+ "License"); you may not use this file except in compliance with the
9
+ License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ------
20
+
21
+ Certain parts of this repository are contributed by others.
22
+ For their license info, see:
23
+
24
+ contrib/legendre_rule_fast.license
25
+ fortran/cmcl_license.txt
26
+ tutorial/utils/lgwt.m
27
+
28
+ ------
29
+
30
+ If you find this library useful, or it helps you in creating software
31
+ or publications, please let us know, and acknowledge that fact by citing our
32
+ source repository:
33
+
34
+ https://github.com/flatironinstitute/finufft
35
+
36
+ and the corresponding journal articles (particularly the first for the CPU
37
+ and/or the last for the GPU):
38
+
39
+ A parallel non-uniform fast Fourier transform library based on an
40
+ ``exponential of semicircle'' kernel. A. H. Barnett, J. F. Magland,
41
+ and L. af Klinteberg. SIAM J. Sci. Comput. 41(5), C479-C504 (2019).
42
+
43
+ Aliasing error of the $\exp (\beta \sqrt{1-z^2})$ kernel in the
44
+ nonuniform fast Fourier transform. A. H. Barnett,
45
+ Appl. Comput. Harmon. Anal. 51, 1-16 (2021).
46
+
47
+ cuFINUFFT: a load-balanced GPU library for general-purpose nonuniform FFTs,
48
+ Yu-hsuan Shih, Garrett Wright, Joakim Andén, Johannes Blaschke, and
49
+ Alex H. Barnett. PDSEC2021 workshop of the IPDPS2021 conference.
50
+ https://arxiv.org/abs/2102.08463
finufft-2.3.0/PKG-INFO ADDED
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.1
2
+ Name: finufft
3
+ Version: 2.3.0
4
+ Summary: Python interface to FINUFFT
5
+ Author: Jeremy Magland, Daniel Foreman-Mackey, Joakim Anden, Libin Lu, Marco Barbone, Robert Blackwell, Alex Barnett
6
+ Maintainer-Email: Alex Barnett <abarnett@flatironinstitute.org>
7
+ Classifier: License :: OSI Approved :: Apache Software License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: C++
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Operating System :: MacOS :: MacOS X
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Requires-Python: >=3.8
14
+ Requires-Dist: numpy>=1.12.0
15
+ Description-Content-Type: text/markdown
16
+
17
+ # Flatiron Institute Nonuniform Fast Fourier Transform library: FINUFFT
18
+
19
+ [![Actions status](https://github.com/flatironinstitute/finufft/workflows/C++%20Build/badge.svg)](https://github.com/flatironinstitute/finufft/actions)
20
+ [![Read the Docs](https://readthedocs.org/projects/finufft/badge)](https://finufft.readthedocs.io)
21
+ &nbsp;
22
+ [Python wrapper: ![PyPI - Downloads](https://img.shields.io/pypi/dm/finufft)](https://pypi.org/project/finufft)
23
+
24
+ Principal author **Alex H. Barnett** (abarnett@flatironinstitute.org),
25
+ main co-developers Jeremy F. Magland,
26
+ Ludvig af Klinteberg, Yu-hsuan "Melody" Shih, Libin Lu,
27
+ Joakim Andén, Marco Barbone, and Robert Blackwell;
28
+ see `docs/ackn.rst` for full list of contributors.
29
+
30
+ <img align="right" src="docs/logo.png" width="350">
31
+
32
+ <img align="right" src="docs/spreadpic.png" width="400"/>
33
+
34
+ This is a lightweight CPU library to compute the three standard types of nonuniform FFT to a specified precision, in one, two, or three dimensions. It is written in C++ with interfaces to C, Fortran, MATLAB/octave, Python, and (in a separate [repository](https://github.com/ludvigak/FINUFFT.jl)) Julia. It now also integrates the GPU CUDA library cuFINUFFT (which currently does all but type 3).
35
+
36
+ Please see the [online documentation](http://finufft.readthedocs.io/en/latest/index.html) which can also be downloaded as a [PDF manual](https://finufft.readthedocs.io/_/downloads/en/latest/pdf/), and a [project overview](https://users.flatironinstitute.org/~ahb/notes/finufft-project-summary-2023.pdf).
37
+ You will also want to see CPU example codes in the directories `examples`, `test`, `fortran`, `matlab/test`, `matlab/examples`, `python/finufft/test`, etc, and GPU examples in `examples/cuda`, `test/cuda`, etc.
38
+
39
+ If you cannot build via cMake, try the makefile. Python users try `pip install finufft`. See the docs for details. See our GitHub Issues for tips.
40
+
41
+ If you prefer to read text files, the source to generate the above documentation is in human-readable (mostly .rst) files as follows:
42
+
43
+ - `docs/install.rst` : installation and compilation instructions
44
+ - `docs/install_gpu.rst` : installation and compilation for GPU (CUDA)
45
+ - `docs/dirs.rst` : explanation of directories and files in the package
46
+ - `docs/math.rst` : mathematical definitions
47
+ - `docs/cex.rst` : example usage from C++/C
48
+ - `docs/c.rst` : documentation of C++/C function API
49
+ - `docs/c_gpu.rst` : documentation of C++/C function API for GPU library
50
+ - `docs/opts.rst` : optional parameters
51
+ - `docs/error.rst` : error codes
52
+ - `docs/trouble.rst` : troubleshooting advice
53
+ - `docs/tut.rst` and `tutorial/*` : tutorial application examples
54
+ - `docs/fortran.rst` : usage examples from Fortran, documentation of interface
55
+ - `docs/matlab.rst` and `docs/matlabhelp.raw` : using the MATLAB/Octave interface
56
+ - `docs/python.rst` and `python/*/_interfaces.py` : using the Python interface
57
+ - `docs/python_gpu.rst` : Python interface to GPU library
58
+ - `docs/julia.rst` : information for Julia users
59
+ - `docs/devnotes.rst`: notes/guide for developers
60
+ - `docs/related.rst` : other recommended NUFFT packages
61
+ - `docs/users.rst` : some known users of FINUFFT, dependent packages
62
+ - `docs/ackn.rst` : authors and acknowledgments
63
+ - `docs/refs.rst` : journal article references (ours and others)
64
+
65
+
66
+ If you find (cu)FINUFFT useful in your work, please star this repository and
67
+ cite it and the following. It will help us to improve the library if you also
68
+ describe your use case parameters
69
+ [here](https://github.com/flatironinstitute/finufft/discussions/398).
70
+
71
+ For FINUFFT (CPU library):
72
+
73
+ A parallel non-uniform fast Fourier transform library based on an ``exponential of semicircle'' kernel.
74
+ A. H. Barnett, J. F. Magland, and L. af Klinteberg.
75
+ SIAM J. Sci. Comput. 41(5), C479-C504 (2019).
76
+
77
+ For cuFINUFFT (GPU library):
78
+
79
+ cuFINUFFT: a load-balanced GPU library for general-purpose nonuniform FFTs,
80
+ Yu-hsuan Shih, Garrett Wright, Joakim Andén, Johannes Blaschke, Alex H. Barnett,
81
+ PDSEC2021 workshop of the IPDPS2021 conference. https://arxiv.org/abs/2102.08463
@@ -0,0 +1,65 @@
1
+ # Flatiron Institute Nonuniform Fast Fourier Transform library: FINUFFT
2
+
3
+ [![Actions status](https://github.com/flatironinstitute/finufft/workflows/C++%20Build/badge.svg)](https://github.com/flatironinstitute/finufft/actions)
4
+ [![Read the Docs](https://readthedocs.org/projects/finufft/badge)](https://finufft.readthedocs.io)
5
+ &nbsp;
6
+ [Python wrapper: ![PyPI - Downloads](https://img.shields.io/pypi/dm/finufft)](https://pypi.org/project/finufft)
7
+
8
+ Principal author **Alex H. Barnett** (abarnett@flatironinstitute.org),
9
+ main co-developers Jeremy F. Magland,
10
+ Ludvig af Klinteberg, Yu-hsuan "Melody" Shih, Libin Lu,
11
+ Joakim Andén, Marco Barbone, and Robert Blackwell;
12
+ see `docs/ackn.rst` for full list of contributors.
13
+
14
+ <img align="right" src="docs/logo.png" width="350">
15
+
16
+ <img align="right" src="docs/spreadpic.png" width="400"/>
17
+
18
+ This is a lightweight CPU library to compute the three standard types of nonuniform FFT to a specified precision, in one, two, or three dimensions. It is written in C++ with interfaces to C, Fortran, MATLAB/octave, Python, and (in a separate [repository](https://github.com/ludvigak/FINUFFT.jl)) Julia. It now also integrates the GPU CUDA library cuFINUFFT (which currently does all but type 3).
19
+
20
+ Please see the [online documentation](http://finufft.readthedocs.io/en/latest/index.html) which can also be downloaded as a [PDF manual](https://finufft.readthedocs.io/_/downloads/en/latest/pdf/), and a [project overview](https://users.flatironinstitute.org/~ahb/notes/finufft-project-summary-2023.pdf).
21
+ You will also want to see CPU example codes in the directories `examples`, `test`, `fortran`, `matlab/test`, `matlab/examples`, `python/finufft/test`, etc, and GPU examples in `examples/cuda`, `test/cuda`, etc.
22
+
23
+ If you cannot build via cMake, try the makefile. Python users try `pip install finufft`. See the docs for details. See our GitHub Issues for tips.
24
+
25
+ If you prefer to read text files, the source to generate the above documentation is in human-readable (mostly .rst) files as follows:
26
+
27
+ - `docs/install.rst` : installation and compilation instructions
28
+ - `docs/install_gpu.rst` : installation and compilation for GPU (CUDA)
29
+ - `docs/dirs.rst` : explanation of directories and files in the package
30
+ - `docs/math.rst` : mathematical definitions
31
+ - `docs/cex.rst` : example usage from C++/C
32
+ - `docs/c.rst` : documentation of C++/C function API
33
+ - `docs/c_gpu.rst` : documentation of C++/C function API for GPU library
34
+ - `docs/opts.rst` : optional parameters
35
+ - `docs/error.rst` : error codes
36
+ - `docs/trouble.rst` : troubleshooting advice
37
+ - `docs/tut.rst` and `tutorial/*` : tutorial application examples
38
+ - `docs/fortran.rst` : usage examples from Fortran, documentation of interface
39
+ - `docs/matlab.rst` and `docs/matlabhelp.raw` : using the MATLAB/Octave interface
40
+ - `docs/python.rst` and `python/*/_interfaces.py` : using the Python interface
41
+ - `docs/python_gpu.rst` : Python interface to GPU library
42
+ - `docs/julia.rst` : information for Julia users
43
+ - `docs/devnotes.rst`: notes/guide for developers
44
+ - `docs/related.rst` : other recommended NUFFT packages
45
+ - `docs/users.rst` : some known users of FINUFFT, dependent packages
46
+ - `docs/ackn.rst` : authors and acknowledgments
47
+ - `docs/refs.rst` : journal article references (ours and others)
48
+
49
+
50
+ If you find (cu)FINUFFT useful in your work, please star this repository and
51
+ cite it and the following. It will help us to improve the library if you also
52
+ describe your use case parameters
53
+ [here](https://github.com/flatironinstitute/finufft/discussions/398).
54
+
55
+ For FINUFFT (CPU library):
56
+
57
+ A parallel non-uniform fast Fourier transform library based on an ``exponential of semicircle'' kernel.
58
+ A. H. Barnett, J. F. Magland, and L. af Klinteberg.
59
+ SIAM J. Sci. Comput. 41(5), C479-C504 (2019).
60
+
61
+ For cuFINUFFT (GPU library):
62
+
63
+ cuFINUFFT: a load-balanced GPU library for general-purpose nonuniform FFTs,
64
+ Yu-hsuan Shih, Garrett Wright, Joakim Andén, Johannes Blaschke, Alex H. Barnett,
65
+ PDSEC2021 workshop of the IPDPS2021 conference. https://arxiv.org/abs/2102.08463
@@ -0,0 +1,48 @@
1
+ #include <array>
2
+ #include <intrin.h>
3
+ #include <iostream>
4
+
5
+ bool is_sse2_supported() {
6
+ std::array<int, 4> cpui;
7
+ __cpuid(cpui.data(), 1);
8
+ return (cpui[3] & (1 << 26)) != 0;
9
+ }
10
+
11
+ bool is_avx_supported() {
12
+ std::array<int, 4> cpui;
13
+ __cpuid(cpui.data(), 1);
14
+ bool osUsesXSAVE_XRSTORE = (cpui[2] & (1 << 27)) != 0;
15
+ bool cpuAVXSupport = (cpui[2] & (1 << 28)) != 0;
16
+ if (osUsesXSAVE_XRSTORE && cpuAVXSupport) {
17
+ unsigned long long xcrFeatureMask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
18
+ return (xcrFeatureMask & 0x6) == 0x6;
19
+ }
20
+ return false;
21
+ }
22
+
23
+ bool is_avx2_supported() {
24
+ std::array<int, 4> cpui;
25
+ __cpuid(cpui.data(), 7);
26
+ return (cpui[1] & (1 << 5)) != 0;
27
+ }
28
+
29
+ bool is_avx512_supported() {
30
+ std::array<int, 4> cpui;
31
+ __cpuidex(cpui.data(), 7, 0);
32
+ return (cpui[1] & (1 << 16)) != 0;
33
+ }
34
+
35
+ int main() {
36
+ if (is_avx512_supported()) {
37
+ std::cout << "AVX512";
38
+ } else if (is_avx2_supported()) {
39
+ std::cout << "AVX2";
40
+ } else if (is_avx_supported()) {
41
+ std::cout << "AVX";
42
+ } else if (is_sse2_supported()) {
43
+ std::cout << "SSE2";
44
+ } else {
45
+ std::cout << "NONE";
46
+ }
47
+ return 0;
48
+ }
@@ -0,0 +1,21 @@
1
+ # USING CPM TO HANDLE DEPENDENCIES
2
+ if(CPM_SOURCE_CACHE)
3
+ set(CPM_DOWNLOAD_LOCATION
4
+ "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
5
+ elseif(DEFINED ENV{CPM_SOURCE_CACHE})
6
+ set(CPM_DOWNLOAD_LOCATION
7
+ "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
8
+ else()
9
+ set(CPM_DOWNLOAD_LOCATION
10
+ "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
11
+ endif()
12
+
13
+ if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
14
+ message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
15
+ file(
16
+ DOWNLOAD
17
+ https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
18
+ ${CPM_DOWNLOAD_LOCATION})
19
+ endif()
20
+
21
+ include(${CPM_DOWNLOAD_LOCATION})