Nvidia Visual Profiler (Nvidia自带内核执行代码分析软件))
我们都知道CUDA提供了一种提供了一种提高并行计算应用性能的有效方法但是有时候会出现的一个问题是即使我们使用了CUDA即使用了代码并行操作但是代码的时间消耗并没有有效减少还有可能因为代码书写的原因导致运行时间更长这是有可能的。在这种情况下我们就需要可视化代码哪一部分耗时最长NVIDIA在安装时也附带了标准的CUDA安装该工具称为Nvidia Visual Profiler可以使用nvvp启动这个软件。nvvp如果能够看到这个上述窗口O(∩_∩)O哈哈~基本上也就是成功一半。然后选择file-New Session在File位置选择对应的可执行文件然后Next-Finish就在你以为胜利就在眼前的时候会出现如下Warningnvprof log: /home/felaim/nvvp_workspace/.metadata/.plugins/com.nvidia.viper/launch/0/nvprof_11779.log 11779 Warning: ERR_NVGPUCTRPERM - The user does not have permission to profile on the target device. See the following link for instructions to enable permissions and get more information: https://developer.nvidia.com/ERR_NVGPUCTRPERM 11779 Warning: Some profiling data are not recorded. Make sure cudaProfilerStop() or cuProfilerStop() is called before application exit to flush profile data.主要问题提取出来还是权限问题Warning: ERR_NVGPUCTRPERM - The user does not have permission to profile on the target device.NVIDIA官网给出了解决方案https://developer.nvidia.com/nvidia-development-tools-solutions-ERR_NVGPUCTRPERM-permission-issue-performance-counters#SolnAdminTagLZ按照官网可以尝试一下modprobe nvidia NVreg_RestrictProfilingToAdminUsers0但是好像重新启动nvvp并没有什么效果第二方案使用sudo权限出现了以下问题command not found换句话说问题可以总结成执行sudo命令时command not found问题的原因: 在编译sudo包的时候默认开启了- -with-secure-path选项。方法1在/etc/sudoers文件内增加这么一行:Defaults secure_path”/bin:/usr/bin:/usr/local/bin:…”, 把要用的命令path包括进去。方法2用命令的绝对路径。方法3使用sudo的env选项,像这样sudo env PATH$PATH cmd.sh。方法4把脚本拷贝或链接到系统$PATH中。方法5重新编译sudo,不带–with-secure-path选项了.(终极解决办法)。LZ这边选择第二种先看下效果查找nvvp的绝对路径which nvvpsudo /usr/local/cuda-10.1/bin//nvvp具体各个参数什么含义小伙伴们可以自己研究下。参考链接https://blog.csdn.net/xueli1991/article/details/72818921PS今天疫情情况明天要破两万的节奏。。。昨天去了几个药店只买到10个口罩分给妹妹家五个还剩5个但是看香港专家的预测模型暂时还没收敛还属于发散状态只是希望这场疫情快点到达终点武汉加油湖北加油中国加油