Rework FH problem: reduce allocations and improve efficiency#92
Rework FH problem: reduce allocations and improve efficiency#92MaxenceGollier wants to merge 12 commits intoJuliaSmoothOptimizers:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #92 +/- ##
===========================================
- Coverage 99.18% 77.75% -21.44%
===========================================
Files 11 19 +8
Lines 369 481 +112
===========================================
+ Hits 366 374 +8
- Misses 3 107 +104 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
For example, with this version I am trying to get results with the older version but i am running in a ton of problems, it seems that the previous version was not even compatible with |
|
@MaxenceGollier this seems to be extraordinary, I will review it ASAP, yes sure we can meet! |
|
@MaxenceGollier Could you please check that objective, gradients, etc., match the old implementation? |
There was a problem hiding this comment.
Pull request overview
This PR refactors the Fitzhugh–Nagumo (FH) problem implementation to reduce allocations and dependency weight by switching from DifferentialEquations to OrdinaryDiffEqVerner, and by using ReverseDiff-based AD backends.
Changes:
- Replace
DifferentialEquationsusage withOrdinaryDiffEqVernerand introduceReverseDifffor FH objective/residual evaluation. - Rework FH residual/objective to use in-place ODE solves with preallocated buffers.
- Update dependencies/compat and documentation to reflect the new required packages for FH.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
test/runtests.jl |
Switch test deps to OrdinaryDiffEqVerner; SVM test blocks are currently wrapped in a triple-quoted string (disabled). |
src/RegularizedProblems.jl |
Gate FH model loading behind Requires on OrdinaryDiffEqVerner + ReverseDiff. |
src/fh_model.jl |
Major FH rewrite: integrator reuse, in-place residual, ReverseDiff backends. |
Project.toml |
Remove DifferentialEquations from test extras/targets; add OrdinaryDiffEqVerner + ReverseDiff. |
docs/src/index.md |
Document updated imports required for fh_model(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@dpo, @MohamedLaghdafHABIBOULLAH. 1) Time for CI to completefrom ~50 minutes to ~15 minutes :) 2) Matching the old implementationThe result don't match exactly, see explanation below This version: On I was able to check that this is due to the fact that the two solve implementations from 3) Speed and MemoryThis version: On The older version has some faster runs and some are really worse, the newer has a smaller range of time values and it allocates less. |
@dpo, @MohamedLaghdafHABIBOULLAH
closes #91
partially closes #90 by adding the OrdinaryDiffEqVerner dep instead of the much much much larger DifferentialEquations dep.
I will use this for the last problem of #88, with
NLPModelsModifiers.jl.I removed the MLDataSet from the dep because I had compat issues. I am waiting for chengchingwen/Pickle.jl#47 to add it back.
I think nonetheless that having to download a large dataset on each CI run is not a good idea and should be avoided (50 minutes of CI for a package of this scale is ridiculous).
@MohamedLaghdafHABIBOULLAH, this is breaking i would like to see your review on this one and make sure that this does not destroy to much code. Can we meet at GERAD sometime ?