Skip to content

Commit

Permalink
Merge pull request #420 from SciML/blaseltypes
Browse files Browse the repository at this point in the history
Ensure that BLAS is only called with BLAS element types
  • Loading branch information
ChrisRackauckas authored Nov 7, 2023
2 parents d914caa + 731d332 commit b64f2f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/LinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ struct DefaultLinearSolver <: SciMLLinearSolveAlgorithm
alg::DefaultAlgorithmChoice.T
end

const BLASELTYPES = Union{Float32, Float64, ComplexF32, ComplexF64}

include("common.jl")
include("factorization.jl")
include("appleaccelerate.jl")
Expand Down
5 changes: 3 additions & 2 deletions src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function defaultalg(A, b, assump::OperatorAssumptions)
# whether MKL or OpenBLAS is being used
if (A === nothing && !(b isa GPUArraysCore.AbstractGPUArray)) || A isa Matrix
if (A === nothing ||
eltype(A) <: Union{Float32, Float64, ComplexF32, ComplexF64}) &&
eltype(A) <: BLASELTYPES) &&
ArrayInterface.can_setindex(b) &&
(__conditioning(assump) === OperatorCondition.IllConditioned ||
__conditioning(assump) === OperatorCondition.WellConditioned)
Expand All @@ -180,7 +180,8 @@ function defaultalg(A, b, assump::OperatorAssumptions)
DefaultAlgorithmChoice.QRFactorization
elseif __conditioning(assump) === OperatorCondition.SuperIllConditioned
DefaultAlgorithmChoice.SVDFactorization
elseif usemkl
elseif usemkl && (A === nothing ? eltype(b) <: BLASELTYPES :
eltype(A) <: BLASELTYPES)
DefaultAlgorithmChoice.MKLLUFactorization
else
DefaultAlgorithmChoice.LUFactorization
Expand Down

0 comments on commit b64f2f3

Please sign in to comment.