Search code examples
buffercufft

cuFFT buffer used


Do we have a limit for the memory used by cuFFT (particularly for 1D transform). I need to compute FFTs for a huge amount of data and I would like to use the most of my GPU capabilities.

In the User Guide it is documented that

In the worst case, the CUFFT Library allocates space for 8*batch*n[0]*..*n[rank-1] cufftComplex or cufftDoubleComplex elements (where batch denotes the number of transforms that will be executed in parallel, rank is the number of dimensions of the input data (see Multidimensional transforms) and n[] is the array of transform dimensions) for single and doubleprecision transforms respectively.

It also says

Depending on the configuration of the plan, less memory may be used. In some specific cases, the temporary space allocations can be as low as 1*batch*n[0]*..*n[rank-1] cufftComplex or cufftDoubleComplex elements.

"In some specific cases" is meaningless. The specific cases are not specified and a lower limit is useless, we can only use the upper limit "8*....." to limit the memory size used on GM.

In my case, I have a 1D "classic" complex transform and it seems that it uses only "1*....". But I can't verify it. Should I stay along with " 8*batch*n[0]*..*n[rank-1] elements" or does someone have more details about these specific cases ?


Solution

  • Using cufftGetSize1d and cufftPlan1d give you the amount of memory allocated for the buffer. The documentation says cufftPlan1d give an estimation of the maximum amount but I got the same value for the 2 functions with a simple 1D plan.

    Notice that the memory allocated slow down when you compute more FFT. It also slows down when the size of the FFT get higher.

    In my case I use both 64 and 8192 point FFTs, it result that I have the 2 extremities. The 64 points give me 8*batch*n[0] elements allocated and the 8192 points give me only 0.1*batch*n[0] with 1.000.000 FFTs.

    It seems that the minimum size buffer allocated can be lower than 1*batch*n[0] elements (as advanced in the documentation) ...