非连续数据的fft以及cufftPlanMany的适用问题
(2014-04-18 21:32:17)
参考帖子http://hpcbbs.it168.com/thread-7957-1-1.html的内容:
想用到cuda中fft的库 但是fft的输入数据有点怪
例如 我的输入数据是一个向量
一个1行50列的数据(实际上比这大很多,为了举例方便说明)
我想做的是第1 11 21 31 41的五个数据的5点的FFT,第2
12 22 32 42的五个数据的5点的FFT
第3 13 23 33 43的五个数据的5点的FFT.......第10
20 30 40 50的五个数据的5点的FFT
请教下怎么实现??
另一个问题就是cudafft库中的cufftPlanMany的
cufftPlanMany(cufftHandle *plan, int
rank, int *n, int *inembed,
int *inembed,nt istride, int idist,
int *onembed, int ostride,int odist,这几个参数是什么意思??
看了文档了 还是不太明白。。
这个cufftPlanMany能用在解决我上面说明的问题上嘛??
这个问题我已经解决了 在这里说明下吧
,希望对遇到同样问题的人有点帮助。
这个cufftPlanMany其实就能解决我上述的问题
我如下设置了参数就可以了
#define NRANK 1
//FFT维度数--进行NRANK维的fft
int n[NRANK] = { 5
};//fft的点数--输入数据行数
#define BATCH 10
//批处理数--输入数据列数
#define ISTRIDE 10
//进行fft的输入数据间隔点数--即列数(每隔ISTRIDE个点读取一个输入数据进行fft)
int inembed[NRANK] = {5};
//行数 进行fft的点数(每隔ISTRIDE个点读取的输入数据个数)
#define OSTRIDE 1
//fft后的结果输出时每隔OSTRIDE个点输出
int onembed[NRANK] = {5};
//fft后的结果每隔OSTRIDE个点输出的个数
#define IDIST 1
//每次批处理输入数据起始元素间的间隔点数
#define ODIST 5
//每次批处理输出数据的元素间的间隔点数
int isize = 5 * BATCH;//输入数据长度
行数*列数
int osize = 5 * BATCH;//输出数据长度
If you are using cufftPlan3d, the right way to do
it would be to use
cufftplan3d(&plan, x, y, z, type);
Here x means the first dimension, y
means the second and z means the third. In your case,
you can use them as is without any issue.
All parameters are the same for both forward and inverse, except
type which changes from CUFFT_R2C to
CUFFT_C2R.
If you are going to use cufftplanMany, you will
need to do something like this.
int dims[] = {z, y, x}; // reversed order
cufftPlanMany(&plan, 3, dims, NULL, 1, 0, NULL, 1, 0, type, batch);

加载中…