-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add accelerated option to TransmissionAbsorptionConverter using numba #2036
base: master
Are you sure you want to change the base?
Conversation
Comparison of parallelising the log calculation either by indexing a range of values:
Or using a for loop inside the numba loop:
|
Signed-off-by: Hannah Robarts <[email protected]>
chunk_size = 6400 | ||
num_chunks = data.size // chunk_size | ||
|
||
if (self._accelerated) & (num_chunks > 5): |
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.
Why do we compare to 5 here?
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.
Hi Laura, so we don't bother making multiple threads if the dataset is very small so the overhead outweighs the benefit of creating the thread. This will only be the the case for very small datasets
…cImaging/CIL into transmission_absorption_numba
in_flat = arr_in.ravel() | ||
out_flat = arr_out.ravel() | ||
for i in numba.prange(num_chunks): | ||
start = i * chunk_size |
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.
would start += chunk_size
be faster than reallocating and multiplying at each iteration?
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.
Changes
Add accelerated option to TransmissionAbsorptionConverter using numba
Testing you performed
Related issues/links
Closes #2032
Checklist
Contribution Notes
Please read and adhere to the developer guide and local patterns and conventions.
--->