diff --git a/src/appleaccelerate.jl b/src/appleaccelerate.jl index 8758bc563..db684e278 100644 --- a/src/appleaccelerate.jl +++ b/src/appleaccelerate.jl @@ -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, diff --git a/src/default.jl b/src/default.jl index c8f6d7b74..17335958a 100644 --- a/src/default.jl +++ b/src/default.jl @@ -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} :