Skip to content

Commit

Permalink
MKL load fix
Browse files Browse the repository at this point in the history
  • Loading branch information
palday committed Mar 25, 2024
1 parent 01c3916 commit e24752b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions ext/FFTWMKLExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ using FFTW
import MKL_jll
FFTW.libfftw3[] = MKL_jll.libmkl_rt_path
FFTW.libfftw3f[] = MKL_jll.libmkl_rt_path
FFTW.version[] = VersionNumber(split(unsafe_string(cglobal(
(:fftw_version,FFTW.libfftw3[]), UInt8)), ['-', ' '])[2])
end

function __init__()
Expand All @@ -16,6 +18,8 @@ function __init__()
@static if FFTW.fftw_provider == "mkl"

Check warning on line 18 in ext/FFTWMKLExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/FFTWMKLExt.jl#L18

Added line #L18 was not covered by tests
FFTW.libfftw3[] = MKL_jll.libmkl_rt_path
FFTW.libfftw3f[] = MKL_jll.libmkl_rt_path
FFTW.version[] = VersionNumber(split(unsafe_string(cglobal(
(:fftw_version,FFTW.libfftw3[]), UInt8)), ['-', ' '])[2])
end
end

Expand Down
10 changes: 6 additions & 4 deletions src/fft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ correspond to [`r2r`](@ref) and [`r2r!`](@ref), respectively.
function plan_r2r end

## FFT: Implement fft by calling fftw.
const version = Ref{Union{Missing,VersionNumber}}(missing)

const version = VersionNumber(split(unsafe_string(cglobal(
(:fftw_version,libfftw3[]), UInt8)), ['-', ' '])[2])

@static if FFTW.fftw_provider == "fftw"
version[] = VersionNumber(split(unsafe_string(cglobal(
(:fftw_version,libfftw3[]), UInt8)), ['-', ' '])[2])
end
## Direction of FFT

const FORWARD = -1
Expand Down Expand Up @@ -422,7 +424,7 @@ end

# The sprint_plan function was released in FFTW 3.3.4, but MKL versions
# claiming to be FFTW 3.3.4 still don't seem to have this function.
const has_sprint_plan = version >= v"3.3.4" && fftw_provider == "fftw"
const has_sprint_plan = fftw_provider == "fftw" && version[] >= v"3.3.4"

@static if has_sprint_plan
sprint_plan_(plan::FFTWPlan{<:fftwDouble}) =
Expand Down

0 comments on commit e24752b

Please sign in to comment.