Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards a cleaner and more maintainable internals of NonlinearSolve.jl #203

Merged
merged 19 commits into from
Sep 21, 2023

Conversation

avik-pal
Copy link
Member

@avik-pal avik-pal commented Sep 7, 2023

Fixes #195 #158 #140 #63

  • No special jacobian logic is now present in this package
    • Delegates everything to SparseDiffTools
  • Uses ADTypes -- constructs the ADType from the old argument style!

TODOs:

Holding Off Merge till we have some upstream benchmarks

@avik-pal avik-pal marked this pull request as draft September 7, 2023 05:23
@ChrisRackauckas
Copy link
Member

Can we setup a PDE benchmark before merging this so we know that the change is not a performance regression? It shouldn't be, but it would be good to know that the new sparse diff stuff is on par in performance with the setup we had before.

@avik-pal
Copy link
Member Author

avik-pal commented Sep 7, 2023

You mean in SciMLBenchmarks?

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Merging #203 (4cd2d97) into master (bf3a132) will increase coverage by 0.52%.
Report is 4 commits behind head on master.
The diff coverage is 92.25%.

@@            Coverage Diff             @@
##           master     #203      +/-   ##
==========================================
+ Coverage   94.42%   94.94%   +0.52%     
==========================================
  Files           7        8       +1     
  Lines         699      732      +33     
==========================================
+ Hits          660      695      +35     
+ Misses         39       37       -2     
Files Changed Coverage Δ
src/utils.jl 76.66% <75.92%> (-4.77%) ⬇️
src/jacobian.jl 91.83% <90.24%> (+1.02%) ⬆️
src/linesearch.jl 94.73% <94.73%> (ø)
src/ad.jl 97.22% <96.00%> (-2.78%) ⬇️
src/trustRegion.jl 98.88% <97.29%> (+2.06%) ⬆️
src/NonlinearSolve.jl 100.00% <100.00%> (ø)
src/levenberg.jl 97.70% <100.00%> (+1.99%) ⬆️
src/raphson.jl 98.46% <100.00%> (+1.36%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@avik-pal avik-pal marked this pull request as ready for review September 11, 2023 18:36
src/ad.jl Show resolved Hide resolved
@avik-pal avik-pal changed the title [WIP] Towards a cleaner and more maintainable internals of NonlinearSolve.jl Towards a cleaner and more maintainable internals of NonlinearSolve.jl Sep 11, 2023
@avik-pal avik-pal changed the title Towards a cleaner and more maintainable internals of NonlinearSolve.jl [Don't Merge] Towards a cleaner and more maintainable internals of NonlinearSolve.jl Sep 11, 2023
src/ad.jl Outdated Show resolved Hide resolved
@avik-pal avik-pal changed the title [Don't Merge] Towards a cleaner and more maintainable internals of NonlinearSolve.jl Towards a cleaner and more maintainable internals of NonlinearSolve.jl Sep 20, 2023

autodiff = if iip && (ls.autodiff isa AutoZygote || ls.autodiff isa AutoSparseZygote)
@warn "Attempting to use Zygote.jl for linesearch on an in-place problem. Falling back to finite differencing."
AutoFiniteDiff()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not fallback to ForwardDiff if it's being used elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to use VecJac, which doesn't have the forwarddiff yet (I think?). See https://github.com/JuliaDiff/SparseDiffTools.jl/blob/04810f5caea10633504ad44071f1a6b82cb9bb5a/src/differentiation/vecjac_products.jl#L51-L52

I can fix it upstream to just construct jacobian and then multiply, and then change the default here later

@avik-pal
Copy link
Member Author

Needs SciML/DiffEqBase.jl#926

@ChrisRackauckas ChrisRackauckas merged commit b2946b1 into SciML:master Sep 21, 2023
7 of 9 checks passed
@avik-pal avik-pal deleted the ap/cleanup branch September 21, 2023 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inplace Problem Specification for Methods with size(residual) != size(u)
2 participants