Skip to content

Commit 7ced75a

Browse files
Better safeguard on unloadable MKL (#793)
* Better safeguard on unloadable MKL Tries to safeguard julia-actions/setup-julia#300 JuliaLang/julia#55878 where the user has requested an incorrect architecture and thus we may believe we can load MKL until we check `MKL_jll.is_available() == false`. The reason is because we're being lied to about `@static if Sys.ARCH === :x86_64 || Sys.ARCH === :i686` which then makes it take this branch and then MKL does not exist. We could instead check `isapple` another type of workaround here and 99% of users would be perfectly fine, but if this is safe this is slightly better for the 1 remaining Intel Apple user that exists in the wild somewhere. * Update LinearSolve.jl
1 parent f46bfc1 commit 7ced75a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/LinearSolve.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,21 @@ const CRC = ChainRulesCore
5252
# MKL_jll < 2022.2 doesn't support the mixed LP64 and ILP64 interfaces that we make use of in LinearSolve
5353
# In particular, the `_64` APIs do not exist
5454
# https://www.intel.com/content/www/us/en/developer/articles/release-notes/onemkl-release-notes-2022.html
55-
using MKL_jll: MKL_jll, libmkl_rt
55+
using MKL_jll: MKL_jll
5656
const usemkl = MKL_jll.is_available() && pkgversion(MKL_jll) >= v"2022.2"
5757
else
58-
global libmkl_rt
5958
const usemkl = false
6059
end
6160
else
62-
global libmkl_rt
6361
const usemkl = false
6462
end
6563

64+
@static if usemkl
65+
using MKL_jll: libmkl_rt
66+
else
67+
global libmkl_rt
68+
end
69+
6670
# OpenBLAS_jll is a standard library, but allow users to disable it via preferences
6771
if Preferences.@load_preference("LoadOpenBLAS_JLL", true)
6872
using OpenBLAS_jll: OpenBLAS_jll, libopenblas

0 commit comments

Comments
 (0)