Skip to content

Commit 1553c34

Browse files
committed
Merge branch 'main' into vp-precond
2 parents c6c75ae + b293926 commit 1553c34

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
matrix:
1212
version:
1313
- '1'
14+
- '1.6'
1415
os:
1516
- ubuntu-latest
1617
arch:

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LinearSolve"
22
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
33
authors = ["Jonathan <[email protected]> and contributors"]
4-
version = "0.1.0"
4+
version = "0.1.1"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
@@ -26,7 +26,7 @@ Reexport = "1"
2626
SciMLBase = "1.18.6"
2727
Setfield = "0.7, 0.8"
2828
UnPack = "1"
29-
julia = "1"
29+
julia = "1.6"
3030

3131
[extras]
3232
DiffEqProblemLibrary = "a077e3f3-b75c-5d7f-a0c6-6bc4c8ec64a9"

src/default.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ function SciMLBase.solve(cache::LinearCache, alg::Nothing,
77
A = A.A
88
end
99

10+
# Special case on Arrays: avoid BLAS for RecursiveFactorization.jl when
11+
# it makes sense according to the benchmarks, which is dependent on
12+
# whether MKL or OpenBLAS is being used
1013
if A isa Matrix
1114
if ArrayInterface.can_setindex(cache.b) && (size(A,1) <= 100 ||
1215
(isopenblas() && size(A,1) <= 500)
@@ -17,6 +20,9 @@ function SciMLBase.solve(cache::LinearCache, alg::Nothing,
1720
alg = LUFactorization()
1821
SciMLBase.solve(cache, alg, args...; kwargs...)
1922
end
23+
24+
# These few cases ensure the choice is optimal without the
25+
# dynamic dispatching of factorize
2026
elseif A isa Tridiagonal
2127
alg = GenericFactorization(;fact_alg=lu!)
2228
SciMLBase.solve(cache, alg, args...; kwargs...)
@@ -26,14 +32,26 @@ function SciMLBase.solve(cache::LinearCache, alg::Nothing,
2632
elseif A isa SparseMatrixCSC
2733
alg = LUFactorization()
2834
SciMLBase.solve(cache, alg, args...; kwargs...)
35+
36+
# This catches the cases where a factorization overload could exist
37+
# For example, BlockBandedMatrix
2938
elseif ArrayInterface.isstructured(A)
3039
alg = GenericFactorization()
3140
SciMLBase.solve(cache, alg, args...; kwargs...)
41+
42+
# This catches the case where A is a CuMatrix
43+
# Which does not have LU fully defined
3244
elseif !(A isa AbstractDiffEqOperator)
3345
alg = QRFactorization()
3446
SciMLBase.solve(cache, alg, args...; kwargs...)
35-
else
47+
48+
# Not factorizable operator, default to only using A*x
49+
# IterativeSolvers is faster on CPU but not GPU-compatible
50+
elseif cache.u isa Array
3651
alg = IterativeSolversJL_GMRES()
3752
SciMLBase.solve(cache, alg, args...; kwargs...)
53+
else
54+
alg = KrylovJL_GMRES()
55+
SciMLBase.solve(cache, alg, args...; kwargs...)
3856
end
3957
end

0 commit comments

Comments
 (0)