2015-11-25 57 views
0

我开始移植现有的fftw3应用程序以使用cuda fftw库。最初阶段是简单地用cufft.h标题替换fftw3.h标题并链接标记库而不是fftw3库。调试CUFFTW接口计划创建

这很简单,代码编译为nvcc。但是,当我执行代码时,应用程序无法使用fftw_plan_guru_dft命令创建计划(它只返回0而不是有效的计划)。

由于没有错误报告,所以我不知道如何调试此问题。 cuda-gdbgdb不提供任何进一步的见解。他们只是简单地报告

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

UPDATE:因此,这里的最低工作的例子。正如我在对Talonmies的评论中所提到的,这段代码是由科学微分方程求解器自动生成的。所以请原谅功能名称等

#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; 
} 

除非别人知道我做错了,它看起来像fftw3的这种特殊的功能可能不被cufftw支持。

+2

你能为此做一个repro情况吗?否则,很难知道你在这里期待什么样的答案(或者你真正想问什么) – talonmies

+0

好吧我会看看我能做什么。原始代码是由科学微分方程求解器(xmds.org)自动生成的,所以它有点乱。我只是想从哪里开始,因为fftw_plan_guru_dft不会输出任何错误。 – inJeans

+1

仅供参考:您可以在[这里](http://docs.nvidia.com/cuda/cufft/#fftw-supported-interface)看到'fftw_plan_guru_dft()'仅在cuFFT中得到部分支持。你确定你的用例被支持吗? – talonmies

回答

0

由于talonmies指出,fftw_plan_guru_dft只在cufftw库中有部分支持。如果您使用基本级别fftw_plan_dft,上述示例将运行。更具体地说

#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; 
}