内存位置的第一次机会异常cudaError_enum

时间:2013-08-08 12:30:43

标签: visual-studio-2012 cuda

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

  • Cuda 5.0
  • VS C ++ 2012
  • Quadro K4000

我看过其他帖子有hereherehere,但没有一个能很好地回答我的问题。我正在检查来自CUDA API,CuRAND和CuBLAS的所有返回代码,并且所有返回代码都返回SUCCESS。我在代码中查看了引发问题的地方,恰好是我为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.

应用程序运行得很好,结果对我来说很好但我想知道是什么原因导致这些错误/异常以及如何解决它们,或者我是否应该忽略它们。

1 个答案:

答案 0 :(得分:2)

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

这被认为是CUDA 5.0下的正常行为。我相信在CUDA 5.5中有一些尝试消除它。您可能希望尝试这一点,尽管这不是一个问题。

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