Open stormyweathers opened 5 years ago
This isn't an issue with this library but with how scipy caches FFT data. I had to include a cache destruction function and call it on each loop iteration. Since the size of the FFTs was different in each loop iteration, scipy creates a new FFT plan, but doesn't automatically destroy the old one
import scipy.fftpack._fftpack as sff
def destroy_fft_cache():
sff.destroy_zfft_cache()
sff.destroy_drfft_cache()
sff.destroy_zfftnd_cache()
In my application, I don't know what the optimal number of samples to compute is. So I compute the adjoint and then forward NFFT and check my reconstruction error. I repeatedly call this checker for various sampling factors to find the optimal value. My laptop has enough memory to work up to factor=400.
But when I try to loop through
factors=np.arange(200,400,5)
it segfaults after 205 due to lack of memory.I've monitored the memory usage with
free -m
during execution, and the memory is not freed. I've tried usinggc.collect()
after each reconstruction check, but that didn't change anything.I included my sample data that produces this error.