0

I am begining to port an existing fftw3 application to make use of the cuda fftw libraries. The initial stage is to simply replace the fftw3.h header with the cufft.h header and link the cufft libraries instead of the fftw3 libraries.

That is simple enough, and the code compiles with nvcc. However when I execute the code the application is unable to create a plan using the fftw_plan_guru_dft command (it just returns 0 instead of a valid plan).

Since there are no errors reported I am at a loss as to how I might debug this issue. cuda-gdb and gdb do not provide any further insight. They simply report

Error: Internal error reported by CUDA debugger API (error=7). The application cannot be further debugged.

UPDATE: So here is the minimum working example. As mentioned in my comment to Talonmies, this code is autogenerated by a scientific differential equation solver. So please excuse the function names etc.

#define real Re
#define imag Im

#include <complex>

#undef real
#undef imag

#include <cufftw.h>

#include <stdio.h>

int main(void) {
     int _transform_sizes_index = 1, _loop_sizes_index = 0;
     fftw_iodim _transform_sizes[1], _loop_sizes[2];
     _transform_sizes[0].n = 128;
     _transform_sizes[0].is = 0;
     _transform_sizes[0].os = 0;

    fftw_complex _data_in[128] = {0.};

    static fftw_plan _fftw_forward_plan = NULL;
    _fftw_forward_plan = fftw_plan_guru_dft(
          _transform_sizes_index, _transform_sizes,
          _loop_sizes_index, _loop_sizes,
          reinterpret_cast<fftw_complex*>(_data_in),
          reinterpret_cast<fftw_complex*>(_data_in),
          FFTW_FORWARD, FFTW_PATIENT);
    if (!_fftw_forward_plan)
       printf("Error: Unable to create forward plan\n");

    return 0;
}

Unless anyone else knows what I am doing wrong, it looks like this particular functionality of fftw3 may not be supported by cufftw.

inJeans
  • 199
  • 1
  • 9
  • 2
    Can you make a repro case for this? Otherwise it is very hard to know what sort of answer you are expecting here (or what you are really asking) – talonmies Nov 25 '15 at 06:57
  • Alright I'll see what I can do. The original code is auto generated from a scientific differential equation solver (xmds.org) so it is kind of a mess. I'm just looking for ideas on where to start given that the fftw_plan_guru_dft doesn't output any errors. – inJeans Nov 25 '15 at 07:55
  • 1
    FYI: you can see [here](http://docs.nvidia.com/cuda/cufft/#fftw-supported-interface) that `fftw_plan_guru_dft()` is only partially supported in cuFFT. Are you sure your use case is supported? – talonmies Nov 25 '15 at 08:55
  • Haha. It seems to both supported and unsupported. That might have something to do with it. I'll have to check it out when I am back in the office. Thanks, I'll keep you updated. – inJeans Nov 25 '15 at 10:00

1 Answers1

0

As talonmies pointed out, the fftw_plan_guru_dft only has partial support in the cufftw library. The above example will run if you instead make use of the basic level fftw_plan_dft. More concretely

#define real Re
#define imag Im

#include <complex>

#undef real
#undef imag

#include <cufftw.h>

#include <stdio.h>

int main(void) {
    int _transform_sizes_index = 1, _loop_sizes_index = 0;
    int _transform_sizes[1] = {128};

    fftw_complex _data_in[128] = {0.};

    static fftw_plan _fftw_forward_plan = NULL;
    _fftw_forward_plan = fftw_plan_dft(
          _transform_sizes_index, _transform_sizes,
          reinterpret_cast<fftw_complex*>(_data_in),
          reinterpret_cast<fftw_complex*>(_data_in),
          FFTW_FORWARD, FFTW_PATIENT);
    if (!_fftw_forward_plan)
       printf("Error: Unable to create forward plan\n");

    return 0;
}
Community
  • 1
  • 1
inJeans
  • 199
  • 1
  • 9