Change ThreadedLoop to default to 2 inner axes#3293
Open
Conversation
Original code compiled and ran in debug mode locally, but failed CI tests due to assertion failure in std::optional usage.
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
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.
Extension of #3280.
Closes #3284.
As proven in #3280, where an image processing operation is comparatively cheap, it can be substantially faster to place 2 image axes rather than 1 within the inner loop of the multi-threading mechanism, as there is less time spent achieving synchronisation across threads.
Conversely, I believe the purpose of processing 1D stripes of image data by default rather than slices is that, for a large number of threads relative to the number of slices, a substantial fraction of the runtime could be spent waiting for the last slices to complete, during which time not all threads available are utilised.
As such, my expectation is that fastest execution will be achieved using:
Exactly where the threshold lies I do not know.
I did however find after a first attempt at refining that it is likely a minority of multi-threaded image operations that are sufficiently expensive to warrant the use of one axis in the inner loop. Currently this is exclusively:
dwi2foddwi2tensordwidenoiseIf there's contention about what should & shouldn't be in this list we can do speed tests; but it needs to be with realistic data, not the CI test data.
(@MRtrix3/mrtrix3-devs note also use of
std::optionalfor function arguments; facilitates differentiation between explicit and default values)