httomo.utils.search_max_slices_iterative#
- httomo.utils.search_max_slices_iterative(available_memory: int, get_mem_bytes: Callable[[int], int]) int[source]#
Approximates the maximum number of fitting slices to the GPU memory for a given function. The memory profile of the function must be increasing in the function of the number of slices. First, a linear approximation of the memory profile is performed. If this is not accurate enough, a binary search follows to determine the number of fitting slices. This function never returns a number of slices for what get_mem_bytes(slices) > available_memory.
- Parameters:
available_memory (int) – Bytes of available device memory
get_mem_bytes (Callable[[int], int]) – A functor that produces the bytes of device memory needed for a given number of slices.
- Returns:
Returns the approximation of the maximum number of fitting slices.
- Return type:
int