Skip to content

Conversation

@mfep
Copy link
Collaborator

@mfep mfep commented Nov 19, 2025

padding: False
memory_gpu:
multiplier: None
method: iterative
Copy link
Collaborator

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",
Copy link
Collaborator

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(
Copy link
Collaborator

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],
Copy link
Collaborator

@dkazanc dkazanc Nov 19, 2025

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(
Copy link
Collaborator

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(
Copy link
Collaborator

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...

@mfep mfep force-pushed the remove-stripe-fw-radway-58 branch from 95ba481 to cb99c07 Compare December 1, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants