我试图弄清楚如何使用 CUFFT 库中提供的批处理模式。
我基本上有一个 5300 像素宽和 3500 高的图像。目前这意味着我正在使用 FFTW 在这 5300 个元素上运行 3500 个 1D FFT。
这是在批处理模式下运行 CUFFT 库的一个很好的候选问题吗?必须如何设置数据才能解决此问题?
谢谢
是的,您可以使用批处理模式。
要使用批处理模式,应连续存储 5300 个元素。
这意味着相邻批次之间的距离为 5300。您可以这样:
..........
cufftComplex *host;
cufftComplex *device;
CudaMallocHost((void **)&host,sizeof(cufftComplex)*5300*3500);
CudaMalloc((void **)&devcie,sizeof(cufftComplex)*5300*3500);
//here add the elements,like this:
//host[0-5299] the first batch, host[5300-10599] the second batch ,and up to the 3500th batch.
CudaMemcpy(device,host,sizeof(cufftComplex)*5300*3500,......);
CufftPlan1d(&device,5300,type,3500);
CufftExecC2C(......);
......
有关详细信息,请参阅 CUFFT 手册。
是的,这是一个很好的问题。
你应该走以下路:
有关更多信息,您必须查看 CUFFT 手册