0
votes

I have some code that performs forward and inverse FFTs with FFTW. I'm working on porting some pieces of the code to use NVIDIA CUFFT.

To verify that my CUFFT-based pieces are working properly, I'd like to diff the CUFFT output with the reference FFTW output for a forward FFT. One challenge in implementing this diff is the complex data structure in the two libraries: CUFFT has cufftComplex, and FFTW has fftwf_complex.

Are cufftComplex and fftwf_complex interchangable (e.g. can I cast the CUFFT data type to be compatible with FFTW)? Or, do I need to do something to convert between the two data types?

1

1 Answers

2
votes

The underlying data structures are just a pair of floats in both cases. You should be able to use the C++ reinterpret_cast mechanism to cast a pointer to an host array of cufftComplex to fftwf_complex and vice versa.