-
Notifications
You must be signed in to change notification settings - Fork 95
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
Trying to speed up STIR acquisition data algebra by avoiding unnecessary 0-fill of newly created data. #1549
base: master
Are you sure you want to change the base?
Conversation
Ubuntu jobs fail, see #1550 MacOS is unaffected by that, but has
(note that this will be seen in Debug mode only. Otherwise it will likely lead to a segfault) |
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.
While this would work, it could be a bit surprising to the user, as the effect of set_initialise_with_zeros()
would be permanent. In the use-case that you have in mind, that'd be fine, but it'd have to come with serious warnings in the doxygen.
I'm rather in favour of having an explicit bool
argument to grow
and resize
(defaulting to true
). We could then have that for the constructor as well.
Please also use |
No point in pushing until I've sorted out #1552, which you'll have to merge here. |
#1552 is now merged, so merge |
I still think this would be a better option. @danieldeidda @markus-jehl what do you think? |
I tend to agree with @KrisThielemans, that explicitly stating it may be cleaner rather than relying on an internal setting on individual instances of the Array class. Just because I can imagine running into weird issues and struggling for a while before noticing what is going on 😅 |
Changes in this pull request
Unnecessary 0-fill of newly created acquisition data reduced.
Testing performed
The following SIRF Python script (employing STIR via SIRF Python interface) was used for comparing STIR's
ProjDataInMemory
algebra performance withnumpy
:With a recent STIR, the output looks like
demonstrating that STIR's
ProjDataInMemory
algebra is much less efficient thannumpy
algebra applied toProjDataInMemory
data copied intonumpy
array. The investigation of this issue revealed that a considerable chunk of the computation time was wasted on zero-filling the newly createdProjDataInMemory
object wherex + y
data is to end up.This PR succeeded in reducing such waste, so that the timings have become
Related issues
Checklist before requesting a review
documentation/release_XXX.md
has been updated with any functionality change (if applicable)