Is there any way to get an approximation for how much memory the calls to cufftPlan2d and cufftExecC2C are going to need? The application I’m working with needs a TON of memory, so usually the card is completely full. I have methods to flush data to system memory and back when needed, but I have no idea how much data I need to flush in order to allow cufft to work properly. The only two options I’ve come up with are to flush all data before calling cufft (slow, since I need to re-up all of that data when I use it later) or to repeatedly call cufftPlan2D/cufftExecC2C and if I get a CUFFT_ALLOC_FAILED, to go clear up some random amount of memory, then try it again (inefficient, and annoying since the console is then littered with error messages from cufft). Any ideas?
CUFFT memory-related questions generally don’t get the best responses here on the forum. This post is over a year old, but it does give some numbers on what the memory uses are. Whether or not these numbers are still valid, I don’t know:
CUFFT 2d Memory Allocation
One thing you could do is write a program that generates a similar table. Or, generate the table at the beginning of your code (in case it changes b/c of a CUFFT library change or whatnot). Then, use these numbers to decide whether or not memory needs to be cleared up for CUFFT or not.
As a side note, the CUFFT_ALLOC_FAILED error occurs when you initialize the cufft plan. Calling cufftPlan2d allocates the memory that will be needed to complete the FFT. To the best of my knowledge, calling cufftExecC2C doesn’t allocate any new memory. It uses only what has been pre-allocated by cufftPlan2d.