我正在使用 nsight 2.2、Toolkit 4.2、最新的 nvidia 驱动程序,我在我的计算机中使用了几个 GPU。构建自定义 4.2。我在 CUDA 的项目属性上设置了“生成 GPU 输出”,nsight 监视器打开(一切看起来都很棒)。
我在全局内核函数上设置了几个断点。nsight 在函数声明处停止,但会跳过几个断点。这就像 nsight 决定是打断点还是跳过断点。有趣的是,nsight 会在 for 循环处停止,但不会在简单的赋值操作上停止。
另一个问题是我无法设置焦点或将变量添加到监视列表。在这种情况下(请参阅随附的屏幕截图),我无法解析变量的值:“posss”或“testDetctoinRate1”在这种情况下是寄存器。另一方面,共享内存或块内存会自动插入到本地列表中。
我通过以下调用唤起我的内核函数:
checkCUDA<<<1, 32>>>(sumMat->rows,sumMat->cols , (UINT *)pGPUsumMat);
cudaError = cudaGetLastError();
if(cudaError != cudaSuccess)
{
printf("CUDA error: %s\n", cudaGetErrorString(cudaError));
exit(-1);
}
内核调用没有错误。
是否有任何选项可以强制 nsight 在所有断点处停止?如何将线程的寄存器添加到我的观察列表?
更新
最初,我的调试命令行如下:
# Runtime API (NVCC Compilation Type is hybrid object or .c file)
set CUDAFE_FLAGS=--sdk_dir "c:\Program Files\Microsoft SDKs\Windows\v7.0A\"
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" --use-local-env --cl-version 2010 -ccbin "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin" -I"..\..\..\opencv\modules\gpu\src\opencv2\gpu\device" -I"..\..\..\opencv\modules\gpu\include\opencv2\gpu" -I"..\..\..\build\include\\" -G --keep-dir "Debug" -maxrregcount=0 --machine 32 --compile -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "Debug\%(Filename)%(Extension).obj" "%(FullPath)"
我在属性页上更改了 --> cuda --> 主机 --> 生成托管调试信息 --> 否
现在我的命令行不包含 -g 和 -O 字母,我的命令行如下:
# Runtime API (NVCC Compilation Type is hybrid object or .c file)
set CUDAFE_FLAGS=--sdk_dir "c:\Program Files\Microsoft SDKs\Windows\v7.0A\"
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" --use-local-env --cl-version 2010 -ccbin "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin" -I"..\..\..\opencv\modules\gpu\src\opencv2\gpu\device" -I"..\..\..\opencv\modules\gpu\include\opencv2\gpu" -I"..\..\..\build\include\\" -G --keep-dir "Debug" -maxrregcount=0 --machine 32 --compile -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "Debug\%(Filename)%(Extension).obj" "%(FullPath)"
虽然,我用 进行调试-o
,这有关系吗?它没有任何改变。