天天看点

Nsight Compute Profile Kernel无法定位源码问题

Nsight Compute是NVIDIA提供的性能分析工具。本人在剖析核函数过程中遇到了无法定位源码的问题。在此记录原因与解决方法。

Nsight Compute Profile Kernel无法定位源码问题

如图,在Profile Kernel时,想要查看源码中某行代码的性能情况,发现只能查看汇编,无法查看源码。

造成这个现象的原因是:编译时没添加调试信息,因此只能定位汇编,无法定位源码。

处理方法:这里编译通过VS集成CUDA的编译器,设置调试信息位置如下:

Project->属性->CUDA C/C++ ->Device ->Generate

Nsight Compute Profile Kernel无法定位源码问题

重新编译后再次Profile,可以看到源码信息,界面如下:

Nsight Compute Profile Kernel无法定位源码问题

继续阅读