Skip to content

Commit

Permalink
fix: make fftw planner threadsafe (quick n dirty)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Krimmer committed Sep 9, 2024
1 parent 7c12ff4 commit d8934c3
Show file tree
Hide file tree
Showing 2 changed files with 9 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
8 changes: 8 additions & 0 deletions src/FINUFFT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export finufftReal
# By default we depend on our precompiled generic binary package...
using finufft_jll
const libfinufft = finufft_jll.libfinufft
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 +48,11 @@ 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
ccall((:fftw_make_planner_thread_safe, libfftw3), Cvoid, (Cvoid,), Ref(nothing))
ccall((:fftwf_make_planner_thread_safe, libfftw3f), Cvoid, (Cvoid,), Ref(nothing))

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

0 comments on commit d8934c3

Please sign in to comment.