How CuFFT Complex data is stored?

I want to know how cufft complex array is stored. For example if have 4 values which are (1,2) , (3,6), (-1,3), (0,4).
Do these values stored in single array similar to float array of {1,2,3,6,-1,3,0,4} or array of structures {(1,2) , (3,6), (-1,3), (0,4)}?

Can some one please explain me this?


Assuming you use the type cufftComplex defined in cufft.h:

they are stored in an array of structures. But there is no difference in actual underlying memory storage pattern between the two examples you have given, and the cufft API could be made to work with either one.

There are various cufft sample codes you may want to study also:

Complex type data for CUFFT and CUBLAS is stored as a structure containing the real part followed by the imaginary part. This layout is compatible with the complex type layout used by C, C++, and Fortran, and there should be no interoperability issues with those. Arrays of complex data are thus using an AOS (array of structure) memory layout.

Note that some software (notably Matlab) stores arrays of complex numbers as an array of the real components followed by an array of imaginary components, that is, an SOA (structure of arrays) memory layout. In such a case you will have to interleave and de-interleave when moving data from/to CUDA. I gave an example of how to do the interleaving as part of the host-to-device copy here: