diff --git a/lib/SimpleNonlinearSolve/Project.toml b/lib/SimpleNonlinearSolve/Project.toml index 1962d42cf..3a20a18b2 100644 --- a/lib/SimpleNonlinearSolve/Project.toml +++ b/lib/SimpleNonlinearSolve/Project.toml @@ -49,6 +49,7 @@ FiniteDiff = "2.24.0" ForwardDiff = "0.10.36" InteractiveUtils = "<0.0.1, 1" LinearAlgebra = "1.10" +LineSearch = "0.1.3" MaybeInplace = "0.1.4" NonlinearSolveBase = "1" PrecompileTools = "1.2" diff --git a/lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl b/lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl index 29adc7131..d772f44d3 100644 --- a/lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl +++ b/lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl @@ -75,29 +75,33 @@ end function solve_adjoint_internal end @setup_workload begin - for T in (Float32, Float64) + for T in (Float64,) prob_scalar = NonlinearProblem{false}((u, p) -> u .* u .- p, T(0.1), T(2)) prob_iip = NonlinearProblem{true}((du, u, p) -> du .= u .* u .- p, ones(T, 3), T(2)) prob_oop = NonlinearProblem{false}((u, p) -> u .* u .- p, ones(T, 3), T(2)) + # Only compile frequently used algorithms -- mostly from the NonlinearSolve default algs = [ SimpleBroyden(), # SimpleDFSane(), SimpleKlement(), # SimpleLimitedMemoryBroyden(), - SimpleHalley(), - SimpleNewtonRaphson(), - SimpleTrustRegion() + # SimpleHalley(), + SimpleNewtonRaphson(; autodiff = AutoForwardDiff(; chunksize = 1)), + # SimpleTrustRegion() ] @compile_workload begin - for alg in algs, prob in (prob_scalar, prob_iip, prob_oop) - CommonSolve.solve(prob, alg) + @sync for alg in algs + for prob in (prob_scalar, prob_iip, prob_oop) + Threads.@spawn CommonSolve.solve(prob, alg; abstol = 1e-2) + end end end end end + export AutoFiniteDiff, AutoForwardDiff, AutoPolyesterForwardDiff export Alefeld, Bisection, Brent, Falsi, ITP, Ridder