【问题标题】:First-chance exception cudaError_enum at memory location内存位置的第一次机会异常 cudaError_enum
【发布时间】:2013-08-10 04:05:08
【问题描述】:

从 Visual Studio 2012 运行我的应用程序时出现此错误。 开发规范:

  • 库达 5.0
  • VS C++ 2012
  • Quadro K4000

我看到还有其他与hereherehere 相关的帖子,但没有一个可以很好地解决我的问题。我正在检查来自 CUDA API、CuRAND 和 CuBLAS 的所有返回代码,并且都返回成功。我查看了代码中出现问题的地方,恰好是当我为 GPU 创建一个计时器对象时。

我用的是CUDA SDK自带的定时器

struct GpuTimer{
    cudaEvent_t start;
    cudaEvent_t stop;
    GpuTimer(){
        checkCudaErr(
            cudaEventCreate(&start)
            );

        checkCudaErr(
            cudaEventCreate(&stop)
            );
    }
    ~GpuTimer(){
        checkCudaErr(
            cudaEventDestroy(start)
            );
        checkCudaErr(
            cudaEventDestroy(stop)
            );
    }
    void Start(){
        checkCudaErr(
            cudaEventRecord(start, 0)
            );
    }
    void Stop(){
        checkCudaErr(
            cudaEventRecord(stop, 0)
            );
    }
    float Elapsed(){
        float elapsed;
        checkCudaErr(
            cudaEventSynchronize(stop)
            );

        checkCudaErr(
            cudaEventElapsedTime(&elapsed, start, stop)
            );
        return elapsed;
    }
};

所以在我的主要功能中

int main(args)
{
   ...
   ...
   ...
   GpuTimer t;
   ...
   ...
}

在该行执行之后,我得到了

'App.exe' (Win32): Loaded 'C:\Windows\System32\nvcuda.dll'. Module was built without symbols.
'App.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\lpk.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\usp10.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\setupapi.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Unloaded 'C:\Windows\System32\dwmapi.dll'
'App.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\wintrust.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'. Cannot find or open the PDB file.
'App.exe' (Win32): Loaded 'C:\Windows\System32\msasn1.dll'. Cannot find or open the PDB file.
First-chance exception at 0x000007FEFDA29E5D in App.exe: Microsoft C++ exception: cudaError_enum at memory location 0x000000000018EA00. //Repeated 20 times at least

最后,在启动应用程序后,我在输出控制台中看到了这条消息(在 VS2012 上)

'App.exe' (Win32): Loaded 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\cudart64_50_35.dll'. Module was built without symbols.
'App.exe' (Win32): Loaded 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\cublas64_50_35.dll'. Module was built without symbols.
'App.exe' (Win32): Loaded 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\curand64_50_35.dll'. Module was built without symbols.

应用程序运行良好,结果在我看来也不错,但我想知道可能导致此错误/异常的原因以及如何解决它们,或者我是否应该忽略它们。

【问题讨论】:

  • “找不到或 PDB 文件”错误是多余的,这只是意味着您的应用程序想要放入调试器但系统库没有符号文件。你能在你实际使用计时器类的地方显示代码吗?

标签: visual-studio-2012 cuda


【解决方案1】:

您所做的观察与在 CUDA 库中正确捕获和处理的异常有关。在某些情况下,这是 CUDA GPU 操作的正常部分。正如您所观察到的,您的应用程序没有返回任何 API 错误并且可以正常运行。如果您不在可以报告此情况的 VS 环境中,则根本不会观察到此情况。

这在 CUDA 5.0 下被视为正常行为。我相信在 CUDA 5.5 中有一些消除它的尝试。您可能想尝试一下,尽管这两种方式都不是问题。

您可能还对this question/answer 感兴趣。

【讨论】:

  • 令人惊讶的是,我注释掉了那行代码(以及与时间相关的所有内容),我发现这是第一个启动所有这些异常的 CUDA 调用。有这方面的文档吗?
  • 我不知道有关它的任何文档。
  • 我在使用 CUDA cuda blast 时也有同样的经历
猜你喜欢
  • 2012-12-22
  • 1970-01-01
  • 2012-06-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-06-27
  • 1970-01-01
  • 2013-03-14
相关资源
最近更新 更多