我正在尝试弄清楚如何使用 CUFFT 库中提供的批处理模式。
我基本上有一张宽 5300 像素、高 3500 像素的图像。目前,这意味着我正在使用 FFTW 在这 5300 个元素上运行 3500 个一维 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 手册。
关于c++ - 你如何使用CUFFT的批处理模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5234573/