简体   繁体   English

调试CUDA内核

[英]Debugging CUDA kernels

I have an OpenCV application, with additional CUDA( .cu ) files which I would like to debug using Parallel NSight . 我有一个OpenCV应用程序,还有我想使用Parallel NSight调试的其他CUDA( .cu )文件。 NSight debugging works on CUDA samples (without OpenCV .cpp files), but when I try to start the debugger in my application the debugger loads lots of additional modules ("no symbols loaded") and crashes with this error: NSight调试适用于CUDA示例(没有OpenCV .cpp文件),但是当我尝试在应用程序中启动调试器时,调试器会加载许多其他模块(“未加载符号”),并因以下错误而崩溃:

OpenCV Error: Gpu API call (out of memory) in unknown function, file ..\.\
opencv-2.4.4\modules\core\src\gpumat.cpp, line 1415  

Also, a window gets opened: "Microsoft Visual c++ Debug Library", with: "Debug error!" 此外,还会打开一个窗口:“ Microsoft Visual c ++调试库”,带有:“调试错误!” and "R6010 abort has been called". 和“已调用R6010中止”。

What could be the issue? 可能是什么问题? Could loading of this modules be avoided? 是否可以避免加载此模块? I am not sure that they are necessary. 我不确定它们是否必要。

And how to correctly debug CUDA kernels? 以及如何正确调试CUDA内核? I know CPU and GPU code cannot be debugged at the same time. 我知道不能同时调试CPU和GPU代码。

Edit: 编辑:

I am pretty sure that loading of more than 200 kernels makes it crash. 我非常确定,加载200多个内核会使它崩溃。 Single gpu::GpuMat declaration has more than 100 kernels(modules) on its own, then SURF, BFM and similar algorithms run the rest... 单个gpu :: GpuMat声明自己拥有100多个内核(模块),然后其余部分使用SURF,BFM和类似算法运行...

I´d like to debug only kernels in which I put breakpoints (ie my own kernels, not OpenCV ones). 只想调试放置断点的内核(即我自己的内核,而不是OpenCV的内核)。 Is it possible to exclude other modules/kernels somehow? 是否可以以某种方式排除其他模块/内核?

Thanks! 谢谢!

It sounds like symbols have been compiled for all of your OpenCV kernels, and this is not what you want. 听起来好像符号已为所有OpenCV内核编译,但这不是您想要的。 Make sure you are not building OpenCV with CUDA debug flags. 确保您没有使用CUDA调试标志构建OpenCV。 Specifically, you don't want the -g/-G/--debug* flags being passed to nvcc. 具体来说,您不希望将-g / -G /-debug *标志传递给nvcc。

Debugging a lot of kernels, while having effects on performance, should not cause crashes. 调试许多内核虽然会影响性能,但不会导致崩溃。 I would recommend upgrading to Nsight 3.0 which is available now from the Nsight Visual Studio Edition Early Access site. 我建议升级到Nsight 3.0,现在可以从Nsight Visual Studio Edition早期访问站点上获得它。 Many improvements have been made in this version. 此版本已进行了许多改进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM