FFTW-compatible CUFFT returns NULL

I have an application which utilizes fftw, and which could probably benefit from using cuFFT instead. To try it out with minimal investment I simply included the cufft AND cufftw libs (REPLACING the previous fftw-libs), and changed the header from fftw3.h to cufftw.h.

There is an explicit check in the code after a certain fftw-call to create a plan, which checks if a NULL plan was returned, and if so, throws and error. The changes I made to libs and headers, appears to work fine for a number of occasions of this call (I can see the gpu going to work and exiting without error). But at a given call it no longer works; cufftw fails to re-interpret calls to fftw_plan_dft_r2c(…) as well as to fftw_plan_dft_c2r(…). There is no apparent difference in the input between using fftw-libs or cufftw-libs.

I tried to change the calls to haev explicit dimensionality by replcing it with fftw_plan_dft_r2c_3d(…) functions instead, but this did not help.

What I am looking for is experience on the subject; as I understand it the header and libraries being changed is all that should be required for cufftw to step in and work with anything fftw can do (anything which is supported, that is). Is this true? Is there an obvious reason to why the aforementioned function calls would return a NULL plan?

I have exactly the same problem that you report. I actually copied the example code from the CUDACast #8 - CUDA 5.5 cuFFT FFTW API Support: CUDACasts Episode #8: Accelerate FFTW Apps with CUFFT 5.5 | NVIDIA Technical Blog but I get an error when it tries to run of plan creation failed. Here is my code in part:

wplan = fftwf_plan_dft_3d(NX, NY, NZ, input, output, FFTW_FORWARD, FFTW_ESTIMATE);

if (wplan == NULL) {
    printf("FFTW plan creation failed\n");
    return 0x01;
}

Did you ever resolve this difficulty?