Closed tansongchen closed 3 weeks ago
Getting significant perf improvement for in-place functions like
quadratic_f!(du, u, p) = (du .= u .* u .- p)
u0 = fill(1.0, 1000)
p = 2.0
prob = NonlinearProblem(quadratic_f!, u0, p)
algfwd = NewtonRaphson(; linesearch=LineSearchesJL(; method=LineSearches.HagerZhang()))
algrev = NewtonRaphson(; linesearch=LineSearchesJL(; method=LineSearches.HagerZhang(), autodiff=AutoZygote())) # fallback to finitediff
julia> @btime sol = solve(prob, algfwd)
27.795 ms (265 allocations: 15.62 MiB)
Julia> @btime sol = solve(prob, algrev)
50.685 ms (15732 allocations: 133.12 MiB)
Attention: Patch coverage is 77.77778%
with 4 lines
in your changes missing coverage. Please review.
Project coverage is 85.54%. Comparing base (
a74c321
) to head (82944d0
).
Files | Patch % | Lines |
---|---|---|
src/globalization/line_search.jl | 77.77% | 4 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Updated strategy:
Checklist
Additional context
Added forward mode support to line searches. We prefer forward AD for better performance, however, reverse AD is also supported if user explicitly requests it.