Skip to content

Commit 946a45e

Browse files
Fix the dispatch
1 parent 42af75b commit 946a45e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

ext/LinearSolveMKLExt.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ function getrf!(A::AbstractMatrix{<:Float64}; ipiv = similar(A, BlasInt, min(siz
1616
chkstride1(A)
1717
m, n = size(A)
1818
lda = max(1,stride(A, 2))
19+
if isempty(ipiv)
20+
ipiv = similar(A, BlasInt, min(size(A,1),size(A,2)))
21+
end
1922
ccall((@blasfunc(dgetrf_), MKL_jll.libmkl_rt), Cvoid,
2023
(Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
2124
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
@@ -39,7 +42,7 @@ function SciMLBase.solve!(cache::LinearCache, alg::MKLLUFactorization;
3942
A = convert(AbstractMatrix, A)
4043
if cache.isfresh
4144
cacheval = @get_cacheval(cache, :MKLLUFactorization)
42-
fact = LU(getrf!(A)...; ipiv = fact.ipiv)
45+
fact = LU(getrf!(A; ipiv = cacheval.ipiv)...)
4346
cache.cacheval = fact
4447
cache.isfresh = false
4548
end

src/LinearSolve.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ export CudaOffloadFactorization
190190
export MKLPardisoFactorize, MKLPardisoIterate
191191
export PardisoJL
192192
export MKLLUFactorization
193+
export AppleAccelerateLUFactorization
193194

194195
export OperatorAssumptions, OperatorCondition
195196

src/appleaccelerate.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ function aa_getrf!(A::AbstractMatrix{<:Float64}; ipiv = similar(A, BlasInt, min(
2929
chkstride1(A)
3030
m, n = size(A)
3131
lda = max(1,stride(A, 2))
32+
if isempty(ipiv)
33+
ipiv = similar(A, BlasInt, min(size(A,1),size(A,2)))
34+
end
35+
3236
ccall(("dgetrf\$NEWLAPACK\$ILP64", libacc), Cvoid,
3337
(Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
3438
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
@@ -52,7 +56,7 @@ function SciMLBase.solve!(cache::LinearCache, alg::AppleAccelerateLUFactorizatio
5256
A = convert(AbstractMatrix, A)
5357
if cache.isfresh
5458
cacheval = @get_cacheval(cache, :AppleAccelerateLUFactorization)
55-
fact = LU(aa_getrf!(A)...; ipiv = fact.ipiv)
59+
fact = LU(aa_getrf!(A; ipiv = cacheval.ipiv)...)
5660
cache.cacheval = fact
5761
cache.isfresh = false
5862
end

0 commit comments

Comments
 (0)