NVProfiler

  • Visual Profiler
  • nvprof

1.1. Focused Profiling
不需要对程序做任何修改就可以进行profiling,说明依赖的是GPU上的硬件计数器等等,和程序无关。但是可以通过一些开始和结束标识来标记profiling开始和结束的位置,来达到更好的效果,几种典型的场景适合这种固定区域的profiling:

  • 代码分为初始化,拷贝数据,算法kernel运行,拷贝数据,数据校验和后处理,感兴趣的位置是kernel,此时可以采用;
  • 程序是分阶段的,每个阶段互相之间无依赖,每个阶段有不同的算法kernel,此时可以对每个阶段单独分析
  • 程序的迭代次数很多,每次迭代之前性能变化不明显,此时可以对一小部分迭代做分析
    API接口:
    cudaProfilerStart()/cudaProfilerStop() cuda_profiler_api.h
    cuProfilerStart()/cuProfilerStop() cudaProfiler.h
    nvprof –profile-from-start off 关闭从程序开始的profile

event nvprof –query-events,事件是一种硬件计数器,在kernel运行期间不断累计;
metric nvprof –query-metrics 度量是根据一种或多种计数器计算得到的该kernel特有的运行特征

1.2 Marking Regions of CPU Activity
Visual Profiler可以看到所有cpu线程如何调用cuda kernel,为了看到CPU线程在执行GPU函数之外的执行轨迹,需要使用NVIDIA Tools Extension API (NVTX)来修改应用程序,nvprof同样支持。
1.3. Naming CPU and CUDA Resources
You can use the NVIDIA Tools Extension API to assign custom names for your CPU and GPU resources. Your custom names will then be displayed in the Timeline View.
1.4. Flush Profile Data
性能数据默认收集到缓存中,以低优先级落盘,为防止性能数据没及时下盘。可以在所有线程退出之前,调用cuProfilerStop() 强制刷盘。

https://docs.nvidia.com/cuda/profiler-users-guide/index.html#profiling-overview
https://docs.nvidia.com/cuda/cupti/r_main.html#r_main

​Visual Profiler

图形界面,可以看到程序运行的性能测量结果。很强大,很多功能,需要具体下载下来使用一次才能体会。具体TODO

nvprof

命令行,可以分析程序运行的性能测量结果。默认输出到std::err,可以用–log-file看来做重定向。
有非常多的options,cuda/cpu/print/IO 等等options,还有一些执行模式和控制模式可以指定。具体TODO,需要每个指令尝试一下,或者才有需要的时候可以查询解决问题。

Remote Profiling

You can profile your remote application directly from nsight or the Visual Profiler.
Or you can use nvprof to collect the profile data on the remote system and then use nvvp on the host system to view and analyze the data.
TODO尝试运行一次

NVIDIA Tools Extension

提供API接口,完成两个功能

  • Tracing of CPU events and time ranges.
  • Naming of OS and CUDA resources.

TODO

MPI Profiling With nvprof

MPI程序也可以使用nvprof来进行性能分析。

mpirun -np 2 nvprof –annotate-mpi openmpi ./my_mpi_app

TODO

MPS Profiling

You can collect profiling data for a CUDA application using Multi-Process Service(MPS) with nvprof and then view the timeline by importing the data in the Visual Profiler.
TODO

Dependency Analysis

没特别理解什么意思。大概是说程序中不同的片段彼此之间的依赖关系,可以通过这个工具进行分析。
TODO

Metrics Reference

根据硬件事件计数器计算得到的一些性能衡量指标。可根据实际情况进行查询。

Warp State

  • Instruction issued - An instruction or a pair of independent instructions was issued from a warp.
  • Stalled - Warp can be stalled for one of the following reasons.
    • Stalled for instruction fetch - The next instruction was not yet available.指令缓存导致stall
    • Stalled for execution dependency.依赖的寄存器还没准备好,前面的计算指令,FP64,barrier. try to increase instruction-level parallelism (ILP)
    • Stalled for memory dependency - The next instruction is waiting for a previous memory accesses to complete.依赖的寄存器还没准备好,前面的访存指令LD。
    • Stalled for memory throttle - A large number of outstanding memory requests prevents forward progress. 带宽限制,global和shared memory都有一定的带宽限制。
    • Stalled for texture
    • Stalled for sync - The warp is waiting for all threads to synchronize after a barrier instruction.
    • Stalled for constant memory dependency.常量内存的访存行为
    • Stalled for pipe busy - The warp is stalled because the functional unit required to execute the next instruction is busy.FP64导致busy
    • Stalled for not selected - Warp was ready but did not get a chance to issue as some other warp was selected for issue.充分优化的程序
    • Stalled for other - Warp is blocked for an uncommon reason like compiler or hardware reasons. barrier > 18,stall pipeline

Tools/Profiler相关推荐

  1. SQL Server 2012如何打开2016的profiler文件

    作者:markjiang7m2 原文地址:https://www.cnblogs.com/markjiang7m2/p/10980191.html 背景 在上星期,公司负责support的同事接到反馈 ...

  2. SQLSERVER2005的安装目录结构(下)

    SQLSERVER2005的安装目录结构(下) SQLSERVER2005的安装目录结构(下) 上篇介绍了SQLSERVER在注册表里保存的一些设置,这篇介绍他在你的硬盘里存放了哪些组件和工具 带你进 ...

  3. 怎么获取服务器接口文档,服务器接口获取数据

    服务器接口获取数据 内容精选 换一换 伸缩组是具有相同应用场景的实例的集合,是启停伸缩策略和进行伸缩活动的基本单位.伸缩组内定义了最大实例数.期望实例数.最小实例数.虚拟私有云.子网.负载均衡等信息. ...

  4. 【错误记录】Android 应用 POST 网络请求报错 ( java.io.IOException: Cleartext HTTP traffic to xxx not permitted )

    文章目录 一.报错信息 二.解决方案 一.报错信息 报错信息如下 : 执行 post 请求信息 , 报如下错误 : W/System.err: java.io.IOException: Clearte ...

  5. 手机ftp服务器进入制定文件夹,ftp服务器 指定文件夹

    ftp服务器 指定文件夹 内容精选 换一换 本节介绍使用Data Studio时要遵循的安装和配置步骤,以及配置服务器以调试PL/SQL函数的步骤.本章包含如下几节内容:安装Data Studio配置 ...

  6. 【CANN训练营第三季】基于昇腾PyTorch框架的模型训练调优

    文章目录 性能分析工具PyTorch Profiling 性能分析工具CANN Profiling 结业考核 1.使用Pytorch实现LeNet网络的minist手写数字识别. 2.采用课程中学习到 ...

  7. cannot be cast to android.view.inputmethod.InputConnection

    最近一直在使用AS3.1 的Profiler做性能调优,手上的一台华为机子(8.0)一直使用正常,突然换了另一台华为机子(5.1),一运行就崩溃 java.lang.ClassCastExceptio ...

  8. Android开发中遇到的错误处理汇总(持续更新)

    ------------------------------------- read the fucking source code-------------------------------- A ...

  9. Android Studio导致App出现crash的问题

    今天在用Android Studio调式代码的时候发生了一个很奇怪的crash问题,异常log如下: java.lang.ClassCastException: java.lang.ref.SoftR ...

最新文章

  1. 百度黄埔学院计划第四期来了!
  2. 网络工程原理与实践教程实验安排
  3. Codeforces Beta Round #5 C. Longest Regular Bracket Sequence 栈/dp
  4. Sharding-JDBC 1.3.0发布——支持读写分离
  5. ASP.NET Web API MediaTypeFormatter
  6. 文章中运用到的数学公式
  7. 如何求100万长度的数组的中间值元素,采用定向数组只需6个毫秒的算法
  8. Linux下的永中 Office 2004(转)
  9. 4.名词性从句的起源与本质
  10. [POJ 1625] Censored! (AC自动机+DP+高精度)
  11. Python爬虫任务1
  12. 一个SAP开发人员的2017总结:编程与游泳
  13. 如何快速学习Python?
  14. SPSS教程——进行数据的纵向和横向合并
  15. gist feature
  16. 【转】互联网产品经理常用软件及工作平台
  17. Git基本操作和GtHub 特殊技巧
  18. Unity3D_(Shuriken粒子系统)制作简单的烟花爆炸效果
  19. Unity3D GPU Instancing测试
  20. 论文阅读32 | Channel Augmented Joint Learning for Visible-Infrared Recognition

热门文章

  1. caffe accuracy 学习
  2. 微信二维码转换成链接
  3. 计算机网络基础知识总结及思维导图(一)概述
  4. 统计一篇英文文章中26 字母出现的概率
  5. 弹性伸缩,轻松上云-华为云弹性云服务器 ECS
  6. app GPU性能调试笔记
  7. Java 判断平衡二叉树
  8. 使用natapp实现内网穿透详细教程
  9. Python 错题本
  10. python怎么解题_农夫过河问题 Python实现解题