Newbie to cuFFT - how to do real-to-real transforms

Good Afternoon,

I am familiar with CUDA but not with cuFFT and would like to perform a real-to-real transform. I found information on Complex-to-Complex and Complex-to-Real (CUFFT_C2C and CUFFT_C2R). Can anyone help a cuFFT newbie on how to perform a Real-to-Real transform using cuFFT? Some simple, beginner code would be great if possible.

Thank you in advanced for any assistance.

You didn’t mention what you want to do next, so I assume (maybe incorrectly) that what you want is a complex to complex transform.
I spent weeks/months using the R2C and C2R and wondered why I never got meaningful results out of it after operating the elements. The R2C/C2R transforms exploit the hermitian symmetry to calculate the transform outputting just half+1 elements. However, the moment I manipulated these elements, I broke the symmetry, thus messing up the inverse transform.

Then I learned here that what I really needed was the C2C so it would work like how we learn from the books (and as Matlab and Octave work, in case you use these). No, you will not start by providing a complex input (like I imagined), because that’s what you want from the transform.
Please search the threads (it is very recent) and you will find it. It has a complete and working code, corrected by Robert Crovella and I think you will understand in a few minutes.

And you really have to spend time reading and re-reading the documentation.

Thank you @saulocpp for the response. You are correct, I should have been more clear with what I am trying to accomplish. I am simply looking for a way to execute Real-to-Real, no complex value(s) needed. I just wanted to see if there was a CUFFT_R2R call somewhere in cuFFT before I went into building one from scratch.

Thanks again.

There is no R2R call in CUFFT.

CUFFT supports ordinary DFT’s using the FFT methodology. The forward version of these transforms all produce complex (i.e. not purely real) data

What FFTW calls a R2R transform is really one of a subset of 3 special cases:

The first of these 3 is simply the CUFFT R2C transform:

The other 2 are not directly supported by CUFFT. As pointed out in the FFTW docs, these are computed (by FFTW) using the R2C transform data.


Following up on your “As pointed out in the FFTW docs, these are computed (by FFTW) using the R2C transform data” comment. Do you have any example code that illustrates this. I suspect a lot of people get frustrated having to implement this. It would be great if there were some NVidia code for this, especially since it is not an issue on x86 platforms. There the code is readily available and you just use the library on Intel platforms.

Is there any chance Nvidia could think about providing something similar?



As far as I know, FFTW is open source. That means the implementation should be discoverable. The process of converting FFTW calls to CUFFT calls e.g. R2C transform is fairly mechanical.

If you’d like to see something in CUDA, my recommendation is to file a bug at