Skip to content

Commit

Permalink
Add workaround for CUDA.jl issue
Browse files Browse the repository at this point in the history
Add CUDA package as a dependency so that we can engage in a little type
piracy to workaround CUDA.jl issue #1559.  Once CUDA.jl has resolved the
issue, we can drop CUDA as a dependency and remove the type piracy.  For
more details see:

  JuliaGPU/CUDA.jl#1559
  • Loading branch information
david-macmahon committed Jul 10, 2022
1 parent 2085a3b commit 55abfb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.1.0"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

Expand Down
8 changes: 7 additions & 1 deletion src/fftfdr.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
using AbstractFFTs
using LinearAlgebra

# We need to depend on FFTW for access to its flags constants because
# AbstractFFTs defines the planning flags to be "a bitwise-or of FFTW planner
# flags". For more details, see:
# https://github.com/JuliaMath/AbstractFFTs.jl/issues/71
import FFTW
using LinearAlgebra

# Type piracy to workaround CUDA.jl issue #1559. For more details, see:
# https://github.com/JuliaGPU/CUDA.jl/issues/1559
import CUDA: CuArray
AbstractFFTs.plan_brfft(A::CuArray, d::Integer, region; kwargs...) = plan_brfft(A, d, region)

function phasor(k::Integer, n::Integer, r::Float32, N::Integer)
cispi(-2*k*n*r/N)
Expand Down

0 comments on commit 55abfb4

Please sign in to comment.