Skip to content

Commit

Permalink
version gate AppleAccelerate
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Oct 4, 2023
1 parent 730f59c commit 6413b06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/appleaccelerate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ end
default_alias_A(::AppleAccelerateLUFactorization, ::Any, ::Any) = false
default_alias_b(::AppleAccelerateLUFactorization, ::Any, ::Any) = false

const PREALLOCATED_APPLE_LU = begin
const PREALLOCATED_APPLE_LU = @static if VERSION >= v"1.8"
A = rand(0, 0)
luinst = ArrayInterface.lu_instance(A)
LU(luinst.factors, similar(A, Cint, 0), luinst.info), Ref{Cint}()
else
nothing
end

function LinearSolve.init_cacheval(alg::AppleAccelerateLUFactorization, A, b, u, Pl, Pr,
Expand Down
2 changes: 1 addition & 1 deletion src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function defaultalg(A, b, assump::OperatorAssumptions)
__conditioning(assump) === OperatorCondition.WellConditioned)
if length(b) <= 10
DefaultAlgorithmChoice.GenericLUFactorization
elseif appleaccelerate_isavailable()
elseif VERSION >= v"1.8" && appleaccelerate_isavailable()
DefaultAlgorithmChoice.AppleAccelerateLUFactorization
elseif (length(b) <= 100 || (isopenblas() && length(b) <= 500)) &&
(A === nothing ? eltype(b) <: Union{Float32, Float64} :
Expand Down

0 comments on commit 6413b06

Please sign in to comment.