Skip to content

Commit 5c48c33

Browse files
committed
fix: only precompile selected workloads for faster loading
1 parent d17544e commit 5c48c33

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

lib/SimpleNonlinearSolve/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ FiniteDiff = "2.24.0"
4949
ForwardDiff = "0.10.36"
5050
InteractiveUtils = "<0.0.1, 1"
5151
LinearAlgebra = "1.10"
52+
LineSearch = "0.1.3"
5253
MaybeInplace = "0.1.4"
5354
NonlinearSolveBase = "1"
5455
PrecompileTools = "1.2"

lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,29 +75,33 @@ end
7575
function solve_adjoint_internal end
7676

7777
@setup_workload begin
78-
for T in (Float32, Float64)
78+
for T in (Float64,)
7979
prob_scalar = NonlinearProblem{false}((u, p) -> u .* u .- p, T(0.1), T(2))
8080
prob_iip = NonlinearProblem{true}((du, u, p) -> du .= u .* u .- p, ones(T, 3), T(2))
8181
prob_oop = NonlinearProblem{false}((u, p) -> u .* u .- p, ones(T, 3), T(2))
8282

83+
# Only compile frequently used algorithms -- mostly from the NonlinearSolve default
8384
algs = [
8485
SimpleBroyden(),
8586
# SimpleDFSane(),
8687
SimpleKlement(),
8788
# SimpleLimitedMemoryBroyden(),
88-
SimpleHalley(),
89-
SimpleNewtonRaphson(),
90-
SimpleTrustRegion()
89+
# SimpleHalley(),
90+
SimpleNewtonRaphson(; autodiff = AutoForwardDiff(; chunksize = 1)),
91+
# SimpleTrustRegion()
9192
]
9293

9394
@compile_workload begin
94-
for alg in algs, prob in (prob_scalar, prob_iip, prob_oop)
95-
CommonSolve.solve(prob, alg)
95+
@sync for alg in algs
96+
for prob in (prob_scalar, prob_iip, prob_oop)
97+
Threads.@spawn CommonSolve.solve(prob, alg; abstol = 1e-2)
98+
end
9699
end
97100
end
98101
end
99102
end
100103

104+
101105
export AutoFiniteDiff, AutoForwardDiff, AutoPolyesterForwardDiff
102106

103107
export Alefeld, Bisection, Brent, Falsi, ITP, Ridder

0 commit comments

Comments
 (0)