-
Notifications
You must be signed in to change notification settings - Fork 25
Implement several speedups for polar view generation #833
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rather than storing all detector images until the end and then summing them, sum them as they are created. This saves memory and can save a substantial amount of time, especially for 32-subpanel Eiger. For a high resolution polar view and 32-subpanel Eiger, we found a 30% speed up in polar view generation time. Signed-off-by: Patrick Avery <[email protected]>
This can be a time-consuming operation to perform repeatedly. When we reuse the same images over and over again, we should apply the panel buffer beforehand and skip this step when generating the polar view. This results in yet another 40% speedup for generating a bunch of high resolution polar images for 32-subpanel eiger. Signed-off-by: Patrick Avery <[email protected]>
For running repeated caking using the same instrument parameters, it can be substantially faster to precompute the bilinear interpolation parameters and just re-use them every time. This resulted in yet another ~50% speedup on top of the other speedups. Signed-off-by: Patrick Avery <[email protected]>
It runs faster and is more multi-thread friendly. We are also now allowing an output buffer to be passed to the bilinear interpolation. This means that we don't have to instantiate a new output every time. Signed-off-by: Patrick Avery <[email protected]>
This gives us a significant speedup (perhaps 2x) for warping many images in a row that use the same instrument config. Signed-off-by: Patrick Avery <[email protected]>
Signed-off-by: Patrick Avery <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #833 +/- ##
==========================================
+ Coverage 49.26% 49.29% +0.03%
==========================================
Files 143 143
Lines 23109 23135 +26
==========================================
+ Hits 11385 11405 +20
- Misses 11724 11730 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
We can actually completely avoid the intermediate full-size image, and just add valid values to the running sum as we go. This provides yet another 30% speedup on top of all of the other speedups. Signed-off-by: Patrick Avery <[email protected]>
Now there are no intermediary arrays for interpolating bilinear on a bunch of images. Signed-off-by: Patrick Avery <[email protected]>
Signed-off-by: Patrick Avery <[email protected]>
Collaborator
Author
|
Chris Budrow tested and approved these changes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Most of these speedups are applicable for generating a whole bunch of polar view in a row with the same image (i. e.,
cache_coordinate_map=Truewhen instantiating thePolarViewclass), but a few of them also improve performance of creating thePolarViewin general.Overall, we achieved at least a 10x speedup (in serial) for generating a bunch of images in a row, and even more of a speedup for some examples. A list of the improvements are as follows:
Instantiate and provide a re-usable output buffer for the interpolation. We re-use the output buffer for every detector, so that we don't have to repeatedly instantiate a chunk of memory for the output for every detector, as we were doing before.- superseded by number 6.I tested these changes a fair amount, and the output looks completely identical to what it was before.