Cone-beam: huge memory consumption when padding != "zeros"
!484 (merged) added support for padding modes other than zeros.
Cone-beam reconstruction acts on 3D data. Generally speaking the full data volume (+ reconstruction) cannot fit the GPU memory, so reconstruction is done by slabs (with an overlap to account for beam divergence).
It looks like astra re-allocates memory, even when using astra.data3d.GPULink
. So, doing
cone_data --[FDK_CUDA]--> reconstructed_volume
requires 2X the data volume and 2X the reconstruction volume.
When doing padding by nabu:
cone_data --[nabu:CudaPadding]--> padded_cone_data --[astra:FDK_CUDA]--> reconstructed_volume
it requires (cone_data, padded_cone_data*2, reconstructed_volume*2)
.
That's huge! Needs to investigate why memory is duplicated.
Update
BP3D_CUDA
(used by FDK_CUDA
and also with custom filtering) will use textures (so CudaArray) which will duplicate the input data.
Worse, astra expects a sinogram layout in contiguous C-Order (whereas we work on projections layout).
So the memory consumption is 3 * input_data + vol_data
.
Found a couple of interesting discussion along the way:
- https://github.com/astra-toolbox/astra-toolbox/issues/476
- https://github.com/DiamondLightSource/httomo/pull/393/files "astra backprojection makes a copy of input"