简体   繁体   English

cuFFT所需的缓冲区

[英]Required buffer for cuFFT

This question is about the buffer required by cuFFT. 这个问题与cuFFT所需的缓冲区有关。 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. 在最坏的情况下,CUFFT库为8 * batch * n [0] * .. * n [rank-1] cufftComplex或cufftDoubleComplex元素分配空间(其中batch表示将并行执行的转换数,rank为单精度和双精度变换的输入数据的维数(请参见多维变换),n []是变换维数的数组)。

What does "array of transform dimensions" mean? “变换维数数组”是什么意思? How much buffer does cuFFT need? cuFFT需要多少缓冲区? What I understand with the above is that it needs at least 8x the size of the array being FFTed but this does not make sense to me 我对以上内容的了解是,它至少需要被FFT的数组大小的8倍,但这对我来说没有意义

Thanks in advance 提前致谢

Daniel 丹尼尔

The "array of transform dimensions" is the array containing the problem size in each dimension, see the section on multidimensional transforms for more information. “变换维数组”是包含每个维中问题大小的数组,有关更多信息,请参见多维变换部分。

cuFFT is allocating temporary space to be able to accommodate the intermediate data, the part of the doc you quoted says this is "the worst case", so it's not "at least 8x", it's at most. cuFFT正在分配临时空间以容纳中间数据,您引用的文档部分说这是“最坏的情况”,因此它不是“至少8倍”,最多是。 The doc goes on to say: 该文档继续说:

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. 在某些特定情况下,临时空间分配可以低至1 * batch * n [0] * .. * n [rank-1] cufftComplex或cufftDoubleComplex元素。

So for a NxM 2D single precision transform: 因此,对于NxM 2D单精度转换:

1*N*M*sizeof(cufftComplex) <= space for tmp data <= 8*N*M*sizeof(cufftComplex)

Use cufftGetSize1d and cufftEstimate1d to give you the amount of memory allocated for the buffer. 使用cufftGetSize1dcufftEstimate1d为您分配为缓冲区分配的内存量。 The documentation says cufftPlan1d gives an estimation of the maximum amount and cufftGetSize1d provide a more precise estimation. 该文档说cufftPlan1d提供了最大数量的估计,而cufftGetSize1d提供了更精确的估计。

In my case I use both 64 and 8192 point FFTs. 就我而言,我同时使用64点和8192点FFT。 I get the same issue, the buffer size allocate only 1*batch*n[0] elements.I've made the test with different amount of data and different FFT size and I get this same value. 我遇到了同样的问题,缓冲区大小仅分配了1 * batch * n [0]个元素。我用不同的数据量和不同的FFT大小进行了测试,得到了相同的值。

To conclude, if you need to determine the memory used by a FFT, the CuFFT library provide a fonction to do this. 总之,如果您需要确定FFT使用的内存,则CuFFT库提供了执行此操作的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM