How to create interleaved complex from real gpuArray in mex?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Yuxin Yang
am 6 Okt. 2021
Beantwortet: Edric Ellis
am 7 Okt. 2021
Hello, I'm using cufft to program a real-to-complex fft, but I'm not getting the correct result.
Here's my method:
The input is a real gpuArray, and I hope to use cufftExecC2C to obtain a complex gpuArray.
cufftExecC2C requires interleaved complex representation (real-imag-real-imag), and I'm using this function to obtain a complex gpuArray from two real gpuArrays. A_r is a 3-D single precision mxGPUArray.
A_r = mxGPUCreateFromMxArray(prhs[0]);
mxGPUArray * A_i = mxGPUCreateGPUArray(mxGPUGetNumberOfDimensions(A_r),
mxGPUGetDimensions(A_r),
mxGPUGetClassID(A_r),
mxREAL,
MX_GPU_INITIALIZE_VALUES);
mxGPUArray * C = mxGPUCreateComplexGPUArray(A_r, A_i);
My problem is that, is mxGPUCreateGPUArray generating an interleaved complex array?
( I'm aware that cufftExecR2C would be easier for this case, but it omits half of the matrix for hermitian symmetry, and I assume it's slower to recover the original matrix.)
Thanks for any advice!
0 Kommentare
Akzeptierte Antwort
Edric Ellis
am 7 Okt. 2021
Yes, complex mxGPUArray data is always stored in interleaved-complex format, see this doc page for details.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu GPU CUDA and MEX Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!