Skip to content

Commit

Permalink
Temporarily use safe FFTW planning (#66)
Browse files Browse the repository at this point in the history
* fix: make fftw planner threadsafe (quick n dirty)

* fix: ccall signature

* comment on workaround

---------

Co-authored-by: Jonas Krimmer <[email protected]>
  • Loading branch information
jkrimmer and Jonas Krimmer authored Sep 10, 2024
1 parent 7c12ff4 commit 04fd2f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "3.2.0"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
cufinufft_jll = "d94e68af-94a2-5465-a03a-ccb69bb7181e"
finufft_jll = "c41cd5a2-72a3-5203-9076-a500b088fc82"
FFTW_jll = "f5851436-0d7a-5f13-b9de-f02708fd171a"

[compat]
Requires = "1.3"
Expand Down
10 changes: 10 additions & 0 deletions src/FINUFFT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export finufftReal
# By default we depend on our precompiled generic binary package...
using finufft_jll
const libfinufft = finufft_jll.libfinufft
# part of the thread-safety workaround
using FFTW_jll
const libfftw3 = FFTW_jll.libfftw3
const libfftw3f = FFTW_jll.libfftw3f
#
# If instead you want to use your locally-compiled FINUFFT library for more
# performance, comment out the above two code lines, uncomment the upcoming
Expand All @@ -45,6 +49,12 @@ include("simple.jl")

# Only load cuFINUFFT interface if CUDA is present (via `using CUDA`) and functional
function __init__()

# quick and dirty: make fftw thread safe
# get rid of this workaround as soon as https://github.com/flatironinstitute/finufft/pull/548 has been merged and deployed to finufft_jll
ccall((:fftw_make_planner_thread_safe, libfftw3), Cvoid, ())
ccall((:fftwf_make_planner_thread_safe, libfftw3f), Cvoid, ())

@require CUDA="052768ef-5323-5732-b1bb-66c8b64840ba" begin
using .CUDA
include("cufinufft.jl")
Expand Down

0 comments on commit 04fd2f2

Please sign in to comment.