3

I am experiencing some problems with CUDAs FFT library.

I declared the inputs as cuDoubleComplex, but the compiler returns the error that this type is incompatible with parameters of type cufftComplex. After some search through the Internet, I found the file cufft.h, in which there is the line typedef cuComplex cufftComplex;. My problem is that in the library cuComplex.h it is clear that cuComplex has a single floating point precision (typedef cuFloatComplex cuComplex;), but I would like a double precision.

Is this possible?

In particular, I obtain the following:

error: argument of type "cufftDoubleComplex *" is incompatible with parameter of type "cufftComplex *"

at this line:

cufftExecC2C(plan, data1, data2, CUFFT_FORWARD);
Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
Pippo
  • 1,543
  • 3
  • 21
  • 40
  • What function call is producing the compilation error? CUFFT has an explicit `cufftDoubleComplex` type and `CUFFT_D2Z`, `CUFFT_Z2D`, and `CUFFT_Z2Z` operations for double-to-double complex, double complex-to-double, and double complex-to-double-complex calls. You have not made it at all clear where the problem is occurring. – talonmies Jan 02 '13 at 10:55
  • When I try to compile the code with nvcc, I obtain the error `error: no suitable user-defined conversion from "cuComplex" to "cuDoubleComplex" exists` – Pippo Jan 02 '13 at 10:58
  • yes, but *where* in the code you aren't showing. What operation or function call produces the error? – talonmies Jan 02 '13 at 11:07
  • With your suggestions, I tried to implement `cufftDoubleComplex`, but I obtain `error: argument of type "cufftDoubleComplex *" is incompatible with parameter of type "cufftComplex *"` Maybe there are some problems with my installation of CUDA; otherwise, which header should I use? (Currently I have only `#include `). Thank you for your attention. – Pippo Jan 02 '13 at 11:08
  • Sorry, it's here that I obtain the error: `cufftExecC2C(plan, ms, ms, CUFFT_FORWARD);` – Pippo Jan 02 '13 at 11:09
  • 2
    Use `cufftExecZ2Z` instead of `cufftExecC2C`. – sgarizvi Jan 02 '13 at 11:12
  • Thank you very much. I was sure I was making a stupid mistake. :) – Pippo Jan 02 '13 at 11:29
  • 1
    @Pippo: It would be helpful for the next person that comes along if you edit the relevant with the compilation problem into your question for future reference, then accept sgar91's answer. – talonmies Jan 02 '13 at 11:31

1 Answers1

7

The double precision complex data type is defined as cufftDoubleComplex in CUFFT.

Double precision versions of fft in CUFFT are:

cufftExecD2Z() //Real To Complex

cufftExecZ2D() //Complex To Real

cufftExecZ2Z() //Complex To Complex

cufftExecC2C is the single precision version of fft, and expects the input and output pointers to be of type cufftComplex,whereas you are passing it a pointer of type cufftDoubleComplex.

For cufftDoubleComplex data type, you have to use the function cufftExecZ2Z instead, which is for double precision data.

sgarizvi
  • 16,623
  • 9
  • 64
  • 98