会持续更新。。。
1.介绍
nvprof是用来测试了解并优化CUDA或OpenACC应用程序的性能的分析工具。分析工具使您能够从命令行收集和查看分析数据。
2.基本使用
2.1测试程序时间性能
nvprof ./a.out
a.out为编译后的可执行文件
示例结果如下:
2.2结果分析
- Profiling result:是GPU(kernel函数)上运行的时间
- API calls:是在cpu上测量的程序调用API的时间
3 --metrics参数的使用
3.1 occupancy
nvprof --metrics achieved_occupancy ./a.out
3.2 gld_throughput
nvprof --metrics gld_throughput ./a.out
3.3 gdl_efficiency
nvprof --metrics gld_efficiency ./a.out
4 解决工具报错
4.1 Error: unified memory profiling failed.
nvprof ./a.out 改为
nvprof --unified-memory-profiling off ./a.out
这是因为某块内存被设置为了不允许分析,所以需要加–unified-memory-profiling off选项
参考文章
http://www.bubuko.com/infodetail-1120850.html
官网:https://docs.nvidia.com/cuda/profiler-users-guide/