Skip to content

Commit 6169a76

Browse files
Merge pull request #316 from SciML/precompilation
Re-enable some precompilation
2 parents 39e538b + 07604b3 commit 6169a76

File tree

4 files changed

+30
-32
lines changed

4 files changed

+30
-32
lines changed

docs/pages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ pages = ["index.md",
1111
"Solvers" => Any["solvers/solvers.md"],
1212
"Advanced" => Any["advanced/developing.md"
1313
"advanced/custom.md"],
14-
"Release Notes" => "release_notes.md"
14+
"Release Notes" => "release_notes.md",
1515
]

docs/src/release_notes.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## v2.0
44

5-
* `LinearCache` changed from immutable to mutable. With this, the out of place interfaces like
6-
`set_A` were deprecated for simply mutating the cache, `cache.A = ...`. This fixes some
7-
correctness checks and makes the package more robust while improving performance.
8-
* The default algorithm is now type-stable and does not rely on a dynamic dispatch for the choice.
9-
* IterativeSolvers.jl and KrylovKit.jl were made into extension packages.
10-
* Documentation of the solvers has changed to docstrings
5+
- `LinearCache` changed from immutable to mutable. With this, the out of place interfaces like
6+
`set_A` were deprecated for simply mutating the cache, `cache.A = ...`. This fixes some
7+
correctness checks and makes the package more robust while improving performance.
8+
- The default algorithm is now type-stable and does not rely on a dynamic dispatch for the choice.
9+
- IterativeSolvers.jl and KrylovKit.jl were made into extension packages.
10+
- Documentation of the solvers has changed to docstrings

src/LinearSolve.jl

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,29 @@ include("init.jl")
6666
include("extension_algs.jl")
6767
include("deprecated.jl")
6868

69+
@generated function SciMLBase.solve!(cache::LinearCache, alg::AbstractFactorization;
70+
kwargs...)
71+
quote
72+
if cache.isfresh
73+
fact = do_factorization(alg, cache.A, cache.b, cache.u)
74+
cache.cacheval = fact
75+
cache.isfresh = false
76+
end
77+
y = _ldiv!(cache.u, get_cacheval(cache, $(Meta.quot(defaultalg_symbol(alg)))),
78+
cache.b)
79+
80+
#=
81+
retcode = if LinearAlgebra.issuccess(fact)
82+
SciMLBase.ReturnCode.Success
83+
else
84+
SciMLBase.ReturnCode.Failure
85+
end
86+
SciMLBase.build_linear_solution(alg, y, nothing, cache; retcode = retcode)
87+
=#
88+
SciMLBase.build_linear_solution(alg, y, nothing, cache)
89+
end
90+
end
91+
6992
@static if INCLUDE_SPARSE
7093
include("factorization_sparse.jl")
7194
end
@@ -82,7 +105,6 @@ isopenblas() = IS_OPENBLAS[]
82105

83106
import PrecompileTools
84107

85-
#=
86108
PrecompileTools.@compile_workload begin
87109
A = rand(4, 4)
88110
b = rand(4)
@@ -110,7 +132,6 @@ PrecompileTools.@compile_workload begin
110132
sol = solve(prob) # in case sparspak is used as default
111133
sol = solve(prob, SparspakFactorization())
112134
end
113-
=#
114135

115136
export LUFactorization, SVDFactorization, QRFactorization, GenericFactorization,
116137
GenericLUFactorization, SimpleLUFactorization, RFLUFactorization,

src/factorization.jl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,6 @@ function _ldiv!(x::Vector, A::Factorization, b::Vector)
66
ldiv!(A, x)
77
end
88

9-
@generated function SciMLBase.solve!(cache::LinearCache, alg::AbstractFactorization;
10-
kwargs...)
11-
quote
12-
if cache.isfresh
13-
fact = do_factorization(alg, cache.A, cache.b, cache.u)
14-
cache.cacheval = fact
15-
cache.isfresh = false
16-
end
17-
y = _ldiv!(cache.u, get_cacheval(cache, $(Meta.quot(defaultalg_symbol(alg)))),
18-
cache.b)
19-
20-
#=
21-
retcode = if LinearAlgebra.issuccess(fact)
22-
SciMLBase.ReturnCode.Success
23-
else
24-
SciMLBase.ReturnCode.Failure
25-
end
26-
SciMLBase.build_linear_solution(alg, y, nothing, cache; retcode = retcode)
27-
=#
28-
SciMLBase.build_linear_solution(alg, y, nothing, cache)
29-
end
30-
end
31-
329
#RF Bad fallback: will fail if `A` is just a stand-in
3310
# This should instead just create the factorization type.
3411
function init_cacheval(alg::AbstractFactorization, A, b, u, Pl, Pr, maxiters::Int, abstol,

0 commit comments

Comments
 (0)