Skip to content

Commit b64f2f3

Browse files
Merge pull request #420 from SciML/blaseltypes
Ensure that BLAS is only called with BLAS element types
2 parents d914caa + 731d332 commit b64f2f3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/LinearSolve.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ struct DefaultLinearSolver <: SciMLLinearSolveAlgorithm
112112
alg::DefaultAlgorithmChoice.T
113113
end
114114

115+
const BLASELTYPES = Union{Float32, Float64, ComplexF32, ComplexF64}
116+
115117
include("common.jl")
116118
include("factorization.jl")
117119
include("appleaccelerate.jl")

src/default.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function defaultalg(A, b, assump::OperatorAssumptions)
156156
# whether MKL or OpenBLAS is being used
157157
if (A === nothing && !(b isa GPUArraysCore.AbstractGPUArray)) || A isa Matrix
158158
if (A === nothing ||
159-
eltype(A) <: Union{Float32, Float64, ComplexF32, ComplexF64}) &&
159+
eltype(A) <: BLASELTYPES) &&
160160
ArrayInterface.can_setindex(b) &&
161161
(__conditioning(assump) === OperatorCondition.IllConditioned ||
162162
__conditioning(assump) === OperatorCondition.WellConditioned)
@@ -180,7 +180,8 @@ function defaultalg(A, b, assump::OperatorAssumptions)
180180
DefaultAlgorithmChoice.QRFactorization
181181
elseif __conditioning(assump) === OperatorCondition.SuperIllConditioned
182182
DefaultAlgorithmChoice.SVDFactorization
183-
elseif usemkl
183+
elseif usemkl && (A === nothing ? eltype(b) <: BLASELTYPES :
184+
eltype(A) <: BLASELTYPES)
184185
DefaultAlgorithmChoice.MKLLUFactorization
185186
else
186187
DefaultAlgorithmChoice.LUFactorization

0 commit comments

Comments
 (0)