-
Notifications
You must be signed in to change notification settings - Fork 40
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
Even faster storage handling #212
Conversation
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 looks super!
I notier after our discussion that this way the CG coefficients are even more similar to the QuasiNewton rules we have, which I think is super nice.
I just have a few first comments, but mainly usability ideas.
Oh, and one thing that I did notice, the storage until now was also used in DebugActions if I remember correctly so is it possible to keep the storage that general? If it is just a storage for CG coefficient-usage then we can also store 2 variables in the coefficients, since we will always only have one coefficients and there is no need for a shared storage. But maybe this is also just a Naming-Thing for the new storage and it can already be used in the other places? |
I've made the storage changes reusable in other parts such as debug actions, so feel free to use these capabilities elsewhere as well. Just storing two or three variables in coefficient storage would be much easier to code but IIRC you wanted to avoid that. |
Maybe I am mainly arguing about the name the storage then currently has? For now it implements the general (i.e. hopefully reusable) case but is called |
Yes, |
Maybe we could extend |
Ah, now I see, then maybe I misunderstood the code this morning. You are right, the DUS is just a nice encapsulation to keep the “oldCG-types” simple (and now even without own storage) and the main change is in the storage. I somehow read that differently this morning. Then all is fine :) |
Yes, this is correct 👍 . |
Codecov Report
@@ Coverage Diff @@
## master #212 +/- ##
==========================================
- Coverage 99.91% 99.72% -0.20%
==========================================
Files 61 61
Lines 4960 5107 +147
==========================================
+ Hits 4956 5093 +137
- Misses 4 14 +10
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I think this is more or less ready. This work could be continued for other parts of Manopt but for this PR I think these changes are more or less sufficient. My last measurement of Rosenbrock benchmark is below 6 us and about half of all time is performing some actual computations. There is still at least one significant avoidable allocation (in line search) and some potentially avoidable copying but we are entering diminishing returns territory here. I'm quite happy with the overall improvement. BTW, I've quickly checked peformence of quasi-Newton for Rosenbrock and the largest issue is too many allocations. There should be buffers that persist between iterations instead of constantly allocating for everything. |
That reads for me a bit like this is half a PR, since it leave the rest – probably to me – somewhen after I both have understood how this works and I find time to work through all other storages.
line_search Is luckily just one function, but I had designed it to have as less as possible allocations already. So input on which is avoidable and how would be great, if you have spotted it already.
Again, more detail here would be great. I am not an expert on allocations, so just saying – there is something wrong/ inefficient – sure can be done, but then it stays inefficient until someone more clever than me comes along. Also it does definelty not allocate “everything”, that reads like we never reuse anything, which is at least exaggerating. |
Yes, I am sure you did not mean to exaggerate, I was also a bit tired yesterday and maybe overinterpretet. For an action plan. What about
But I not only have the other two PR I am currently not finding much time for, I also have at least 3 additional meetings the next few weeks within a collegial pedagogical mandatory coaching all “new” associate professorsI have to do (besides the language courses). So it might be that step 4 only happens somewhen in March, since currently I only find time to code late in the evenings due to that. |
Yes, sorry, I just meant that there are many places where avoidable allocations happen.
I can make a list of all lines that cause allocation so that's easier to track.
Sure, I will open an issue.
OK, this PR is just an internal change that doesn't block any other work so it can wait.
OK, I think the main issue I need your help with is that each place that wants to store points in the fast storage needs a point as a "template", and similarly for tangent vectors. This requires some redesign unfortunately. Once I have a point or vector at the place creating a storage, I can easily convert it to the fast variant.
No problem, not having this PR merged doesn't block any other work I'm going to do over the next couple of months so that's fine. |
Cool, that sounds like a plan. |
Yes, I will add a test for that line. I also need to take a closer look at performance again. |
Perfect, then we just have to add a small comment in the (now new) Changeling as well. |
…s/Manopt.jl into mbaran/even-faster-storage
I had to add my two PRs of the next version anyways, so we just have to add the date when we merge. edit: Oh I just saw we are a little bit inconsistent and sometimes use |
OK, I will change |
Besides the name (you called it News.md) it is heavily inspired by your approach. I think for breaking changes especially it is important to document what broke and how to fix it. |
Hm, the cleanup might have caused a bit of code coverage loss. Maybe the Nonmonotonelinesearch does not have a proper storage for the case that is not covered (and hence stops early with no change)? I will try to check your recent changes for that maybe the early evening (sorry busy until then). |
I think I know what might be the problem. |
Nice fix! I am not 100% sure we use |
Thanks! Indeed, they are not used in all places where they should be. I will adapt all places except |
Sure, primal-dual plan can stay “slow” for now, since it is quite a bit of work required there which we can do later. |
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.
For me this looks nice now, thanks for all the work.
Before merging, just write a date behind 0.4.8 in the Changelog.
I will write a tutorial that hopefully illustrates the benefits of using storage and even the fast storage as well as how to use them.
Thanks, I'm still going to test this storage a bit more and make an example that illustrates its benefits. |
These are the changes we've discussed yesterday. Right now a bit WIP still but with the fused retractions my CG example is down to about 6 us (from about 80 us IIRC) and looks relatively solid now.