Caching image_response.contents in data interface for deconvolution #255
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.
Description of Change
The data interface class for DC2 (
DataIF_COSI_DC2
inheriting fromImageDeconvolutionDataInterfaceBase
) now has attributeimage_response_contents
initialized toimage_response.contents
. In this way we no longer retrieveimage_response.contents
every iteration in the following deconvolution methods:calc_T_product
(MStep)calc_expectation
(post_processing)Significance
These changes result in a 10x speedup in image_deconvolution. Instead of retrieving image_response.contents before every tensordot, we now only retrieve it once during initialization.
Profiling "no save" (before this change) versus "save" (after this change)
Other Considerations
This could also be solved by setting
track_overflow=False
on theimage_response
matrix usinghistpy==1.1.4
Change does not increase RAM usage. We had previously already allocated memory to the contents during deconvolution.