-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fix extra allocations in get_gradient!'s jacobian #300
Conversation
) | ||
basis_p = _maybe_get_basis(M, p, nlso.jacobian_tangent_basis) | ||
Jval = zeros(nlso.num_components, manifold_dimension(M)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where all the allocations come from, in my case, I give a sparse jacobian as input.
That's a neat solution 👍 |
Codecov Report
@@ Coverage Diff @@
## master #300 +/- ##
==========================================
- Coverage 99.88% 99.64% -0.25%
==========================================
Files 77 77
Lines 7083 7083
==========================================
- Hits 7075 7058 -17
- Misses 8 25 +17
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
To summarise a lengthy chat. The idea proposed here breaks with one central design idea, that the problem (manifold, cost function , gradient,...) is stored in one struct and the state (everything the solver needs between iterates) in another. With these ideas the current (though short) PR breaks – quite a bit. |
I've submitted an alternative fix that doesn't break Manopt's design: #301 -- it should also fix this issue. |
Superseeded by #301 |
I'm not sure of the correct way to fix this, but here is the cause of the extra allocations in my example from: JuliaRobotics/IncrementalInference.jl#1546 (comment)
With this fix it shaves off 15 seconds of a 30-second solve.