0

I'm using CUFFT library in my code.

__global__ void kernel1(...)
{
    /****** processing to get real and imaginary values *******/
    cufftComplex data[SIGANAL_SIZE];


    cufftExecC2C(plan[0],data[0],data[0],CUFFT_FORWARD);

}


int main()
{
   ...
   kernel1<<<N,N>>>(...);
   ...
}

I'm calling cufft functions from my kernel function "kernel1". Can I declare variables of type cufftComplex inside kernel.?

Alvin
  • 940
  • 2
  • 13
  • 27
  • What is the `cufftExecC2C` call doing inside the kernel? – talonmies Jul 05 '13 at 12:34
  • Take a look at [this answer](http://stackoverflow.com/questions/17270433/is-it-possible-to-call-cufft-library-calls-in-device-function/17273394#17273394) – Robert Crovella Jul 05 '13 at 13:03
  • @talonmies that is a function which is provided in CUFFT library – Alvin Jul 05 '13 at 13:10
  • @user2281757: I know what it is. I am asking *why* you have a host library function call inside a CUDA kernel. That is not allowed. – talonmies Jul 05 '13 at 13:25
  • @talonmies would you mind posting a brief answer to this effect? I would appreciate it and would upvote it, so the question can be declared "answered". Or if you prefer I will mark it as a duplicate. – Robert Crovella Jul 05 '13 at 13:33

1 Answers1

3

There is no problem using the cufftComplex type in CUDA kernel code. cufftComplex is just an alias of the standard CUDA single precision complex type cuComplex, which is specifically intended for use in device code.

However, the rest of the code in your question is completely wrong. The cuFFT library is a host side library which cannot be called inside CUDA kernel code. So trying to call cufftExecC2C inside a kernel is completely illegal and won't compile if you try.

talonmies
  • 70,661
  • 34
  • 192
  • 269