@@ -16,10 +16,17 @@ export dct, idct, dct!, idct!, plan_dct, plan_idct, plan_dct!, plan_idct!
1616
1717include (" providers.jl" )
1818
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.
2022 if haskey (ENV , " JULIA_FFTW_PROVIDER" )
2123 Base. depwarn (" JULIA_FFTW_PROVIDER is deprecated; use FFTW.set_provider!() instead" , :JULIA_FFTW_PROVIDER )
2224 end
25+
26+ # Hook FFTW threads up to our partr runtime
27+ @static if fftw_provider == " fftw"
28+ fftw_init_threads ()
29+ end
2330end
2431
2532if VERSION >= v " 1.11.0"
@@ -42,12 +49,6 @@ function dlopen(lib::FakeLazyLibrary)
4249 end
4350 return h
4451end
45- function fftw_init_check ()
46- check_env ()
47- @static if fftw_provider == " fftw"
48- fftw_init_threads ()
49- end
50- end
5152
5253@static if fftw_provider == " fftw"
5354 import FFTW_jll: libfftw3 as libfftw3_no_init,
@@ -60,23 +61,19 @@ const libfftw3 = FakeLazyLibrary(:libfftw3_no_init, fftw_init_check, C_NULL)
6061const libfftw3f = FakeLazyLibrary (:libfftw3f_no_init , fftw_init_check, C_NULL )
6162
6263else
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
6375function __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 ()
8077end
8178end
8279
0 commit comments