-
Notifications
You must be signed in to change notification settings - Fork 0
Support for httomolibgpu's remove_stripe_fw
#82
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
base: main
Are you sure you want to change the base?
Conversation
| padding: False | ||
| memory_gpu: | ||
| multiplier: None | ||
| method: iterative |
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.
Those strings describe how httomo calculates the memory, so far we have only direct and "else". For else we use the name module, which I explain in the comments bellow. But I think you need to make "module" here and make your function iterative bellow.
|
|
||
|
|
||
| __all__ = [ | ||
| "_calc_memory_bytes_for_slices_remove_stripe_fw", |
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.
Again httomo will look exactly into a certain name of the function. So your function needs to be:
_calc_memory_bytes_remove_stripe_fw
| return (tot_memory_bytes, gamma_mem) | ||
|
|
||
|
|
||
| def _calc_memory_bytes_for_slices_remove_stripe_fw( |
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.
and this should be _calc_memory_bytes_remove_stripe_fw
|
|
||
|
|
||
| def _calc_memory_bytes_for_slices_remove_stripe_fw( | ||
| dims_shape: Tuple[int, int, int], |
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.
then here we have a bigger problem. Passing a 3 values in the tuple why only 2 are accepted. We call that non_slice_dims_shape, which are 2 dimensions of the data that we know. See this function. In the case of the sinogram pattern, these are known shapes: number of angles and detector dimension X. What we don't know is the size of detector Y or the number of slices with the size non_slice_dims_shape we can fit into a GPU.
So when you pass the slices value - this is unknown and needs to be estimated in this function.
| ) # the amount of memory in bytes needed for the method according to memoryhook | ||
|
|
||
| # now we estimate how much of the total memory required for this data | ||
| (estimated_memory_bytes, subtract_bytes) = _calc_memory_bytes_for_slices_remove_stripe_fw( |
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.
like here you're passing slices into the function, but we need to estimate that instead.
| ) | ||
| return memory_bytes | ||
|
|
||
| def calculate_memory_bytes_for_slices( |
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.
So I can suggest to have a function that is exactly _calc_memory_bytes_remove_stripe_fw for httomo to recognise it following the protocol. But inside this function can be another function like you wrote here that would iteratively find the number of bytes or eventually slices it can fit into a GPU. I can see that you need to have loop that would start with the minimal amount of slices/bytes that always should fit, e.g. 3 slices and then have an increment of 3 may be? Then at some point when you know you can't fit more take the previous value in that loop. This is why I was mentioned before that you'd need to run multiple iterations of your estimator to find the correct value? Hope it makes sense, please drop questions if something is unclear. I might misunderstood some things...
95ba481 to
cb99c07
Compare
calculate_memory_bytes_for_slicesthat can be used to estimate the device memory requirements of a function run on a 3D grid.remove_stripe_fwfrom httomolibgpu