mckib2 / pygrappa

Python implementations of GRAPPA-like algorithms.
https://pygrappa.readthedocs.io/en/latest/
MIT License
64 stars 13 forks source link

Memory Allocation #99

Open Zzariry opened 1 year ago

Zzariry commented 1 year ago

Hello,

I tried to use your code to reconstruct 3D anatomical brain MRI data of 1mm iso resolution with the mdgrappa function, it works well even if it is time-consuming, however when going to 0.7mm data with a large matrix (252, 52, 350, 256), and 52 the number of coils. ACS built-in (252, 52, 33, 256), the program crashes as it tries to allocate 471 GB of Ram. Do you please have an optimized version of your code to manage better the compute server resources?

The configuration I have:

Thank you, Zakaria

mckib2 commented 1 year ago

I will take a look at this, I believe the issue is most likely due to a call to skimage.util.view_as_windows over a large portion of that window which blows up the size. There is likely a way to refactor this to do this iteratively

Zzariry commented 1 year ago

Thanks for your answer, it was at the memory allocation for the S array that it showed me that it could not allocate 471 GB, When I changed the kernel size to (3, 3, 3) instead of (5, 5, 5), and the ACS to (252, 52, 33, 48), there is no longer this problem, even if I think that the size of the S-matrix has nothing that could be related to the kernel (if I'm not mistaken).