nabu.pipeline.fullfield.computations module

nabu.pipeline.fullfield.computations.estimate_required_memory(process_config, delta_z=None, delta_a=None, max_mem_allocation_GB=None, debug=False)[source]

Estimate the memory (RAM) needed for a reconstruction.

Parameters:
  • process_config (ProcessConfig object) – Data structure with the processing configuration

  • delta_z (int, optional) – How many lines are to be loaded in the each projection image. Default is to load lines [start_z:end_z] (where start_z and end_z come from the user configuration file)

  • delta_a (int, optional) – How many (partial) projection images to load at the same time. Default is to load all the projection images.

  • max_mem_allocation_GB (float, optional) – Maximum amount of memory in GB for one single array.

Returns:

required_memory – Total required memory (in bytes).

Return type:

float

Raises:

ValueError if one single-array allocation exceeds "max_mem_allocation_GB"

Notes

pycuda <= 2022.1 cannot use arrays with more than 2**32 items (i.e 17.18 GB for float32). This was solved in more recent versions.

nabu.pipeline.fullfield.computations.estimate_max_chunk_size(available_memory_GB, process_config, pipeline_part='all', n_rows=None, step=10, max_mem_allocation_GB=None)[source]

Estimate the maximum size of the data chunk that can be loaded in memory.

Parameters:
  • available_memory_GB (float) – available memory in Giga Bytes (GB - not GiB !).

  • process_config (ProcessConfig) – ProcessConfig object

  • pipeline_part (str) –

    Which pipeline part to consider. Possible options are:
    • ”full”: Account for all the pipeline steps (reading data all the way to reconstruction).

    • ”radios”: Consider only the processing steps on projection images (ignore sinogram-based steps and reconstruction)

    • ”sinogram”: Consider only the processing steps related to sinograms and reconstruction

  • n_rows (int, optional) – How many lines to load in each projection. Only accounted for pipeline_part=”radios”.

  • step (int, optional) – Step size when doing the iterative memory estimation

  • max_mem_allocation_GB (float, optional) – Maximum size (in GB) for one single array.

Returns:

n_max – If pipeline_par is “full” or “sinos”: return the maximum number of lines that can be loaded in all the projections while fitting memory, i.e data[:, 0:n_max, :] If pipeline_part is “radios”, return the maximum number of (partial) images that can be loaded while fitting memory, i.e data[:, zmin:zmax, 0:n_max]

Return type:

int

Notes

pycuda <= 2022.1 cannot use arrays with more than 2**32 items (i.e 17.18 GB for float32). This was solved in more recent versions.