@@ -16,10 +16,17 @@ export dct, idct, dct!, idct!, plan_dct, plan_idct, plan_dct!, plan_idct!
16
16
17
17
include (" providers.jl" )
18
18
19
- function check_env ()
19
+ function fftw_init_check ()
20
+ # If someone is trying to set the provider via the old environment variable, warn them that they
21
+ # should instead use `set_provider!()` instead.
20
22
if haskey (ENV , " JULIA_FFTW_PROVIDER" )
21
23
Base. depwarn (" JULIA_FFTW_PROVIDER is deprecated; use FFTW.set_provider!() instead" , :JULIA_FFTW_PROVIDER )
22
24
end
25
+
26
+ # Hook FFTW threads up to our partr runtime
27
+ @static if fftw_provider == " fftw"
28
+ fftw_init_threads ()
29
+ end
23
30
end
24
31
25
32
if VERSION >= v " 1.11.0"
@@ -42,12 +49,6 @@ function dlopen(lib::FakeLazyLibrary)
42
49
end
43
50
return h
44
51
end
45
- function fftw_init_check ()
46
- check_env ()
47
- @static if fftw_provider == " fftw"
48
- fftw_init_threads ()
49
- end
50
- end
51
52
52
53
@static if fftw_provider == " fftw"
53
54
import FFTW_jll: libfftw3 as libfftw3_no_init,
@@ -60,23 +61,19 @@ const libfftw3 = FakeLazyLibrary(:libfftw3_no_init, fftw_init_check, C_NULL)
60
61
const libfftw3f = FakeLazyLibrary (:libfftw3f_no_init , fftw_init_check, C_NULL )
61
62
62
63
else
64
+ @static if fftw_provider == " fftw"
65
+ import FFTW_jll: libfftw3_path as libfftw3_no_init,
66
+ libfftw3f_path as libfftw3f_no_init,
67
+ libfftw3_path as libfftw3,
68
+ libfftw3f_path as libfftw3f
69
+ elseif fftw_provider == " mkl"
70
+ import MKL_jll: libmkl_rt_path as libfftw3_no_init,
71
+ libmkl_rt_path as libfftw3f_no_init,
72
+ libmkl_rt_path as libfftw3,
73
+ libmkl_rt_path as libfftw3f
74
+ end
63
75
function __init__ ()
64
- # If someone is trying to set the provider via the old environment variable, warn them that they
65
- # should instead use `set_provider!()` instead.
66
- check_env ()
67
-
68
- global libfftw3
69
- global libfftw3f
70
- # Hook FFTW threads up to our partr runtime
71
- @static if fftw_provider == " fftw"
72
- libfftw3 = FFTW_jll. libfftw3_path
73
- libfftw3f = FFTW_jll. libfftw3f_path
74
- fftw_init_threads ()
75
- end
76
- @static if fftw_provider == " mkl"
77
- libfftw3 = MKL_jll. libmkl_rt_path
78
- libfftw3f = MKL_jll. libmkl_rt_path
79
- end
76
+ fftw_init_check ()
80
77
end
81
78
end
82
79
0 commit comments