【问题标题】:get the execution time in nvprof在 nvprof 中获取执行时间
【发布时间】:2018-10-05 21:03:25
【问题描述】:

有没有办法像度量一样在 nvprof 中获取内核执行时间?

例如,要获取我键入的 DRAM 读取事务:

nvprof --metrics dram_read_transactions ./myprogram

我的问题是:有没有类似的东西

nvprof --metrics execution_time ./myprogram

我想在一个命令行中收集一小组指标,而不必使用

nvprof ./myprogram

作为单独的命令。

【问题讨论】:

    标签: cuda nvprof


    【解决方案1】:

    相信您正在寻找:nvprof --print-gpu-trace ./myprogram

    【讨论】:

      【解决方案2】:

      您应该在 nVIDIA 的“CUDA Pro Tip”博客上阅读这篇文章:

      CUDA Pro Tip: nvprof is Your Handy Universal GPU Profiler

      它会引导您了解如何使用 nvprof 来分析和计时您的应用程序的一些基础知识。具体来说,如果你写这样的东西:

      nvprof --print-gpu-trace ./nbody --benchmark -numdevices=2 -i=1
      

      (该示例用于 n 体物理问题模拟器),您的输出将包括以下内容:

      ...
      ==4125== Profiling application: ./nbody --benchmark -numdevices=2 -i=1
      ==4125== Profiling result:
         Start  Duration            Grid Size      Block Size     Regs*    SSMem*    DSMem*      Size  Throughput           Device   Context    Stream  Name
      260.78ms     864ns                    -               -         -         -         -        4B  4.6296MB/s   Tesla K20c (0)         2         2  [CUDA memcpy HtoD]
      260.79ms     960ns                    -               -         -         -         -        4B  4.1667MB/s  GeForce GTX 680         1         2  [CUDA memcpy HtoD]
      260.93ms     896ns                    -               -         -         -         -        4B  4.4643MB/s   Tesla K20c (0)         2         2  [CUDA memcpy HtoD]
      260.94ms     672ns                    -               -         -         -         -        4B  5.9524MB/s  GeForce GTX 680         1         2  [CUDA memcpy HtoD]
      268.03ms  1.3120us                    -               -         -         -         -        8B  6.0976MB/s   Tesla K20c (0)         2         2  [CUDA memcpy HtoD]
      268.04ms     928ns                    -               -         -         -         -        8B  8.6207MB/s  GeForce GTX 680         1         2  [CUDA memcpy HtoD]
      268.19ms     864ns                    -               -         -         -         -        8B  9.2593MB/s   Tesla K20c (0)         2         2  [CUDA memcpy HtoD]
      268.19ms     800ns                    -               -         -         -         -        8B  10.000MB/s  GeForce GTX 680         1         2  [CUDA memcpy HtoD]
      274.59ms  2.2887ms             (52 1 1)       (256 1 1)        36        0B  4.0960KB         -           -   Tesla K20c (0)         2         2  void integrateBodies(vec4::Type*, vec4::Type*, vec4::Type*, unsigned int, unsigned int, float, float, int) [242]
      274.67ms  981.47us             (32 1 1)       (256 1 1)        36        0B  4.0960KB         -           -  GeForce GTX 680         1         2  void integrateBodies(vec4::Type*, vec4::Type*, vec4::Type*, unsigned int, unsigned int, float, float, int) [257]
      276.94ms  2.3146ms             (52 1 1)       (256 1 1)        36        0B  4.0960KB         -           -   Tesla K20c (0)         2         2  void integrateBodies(vec4::Type*, vec4::Type*, vec4::Type*, unsigned int, unsigned int, float, float, int) [275]
      276.99ms  979.36us             (32 1 1)       (256 1 1)        36        0B  4.0960KB         -           -  GeForce GTX 680         1         2  void integrateBodies(vec4::Type*, vec4::Type*, vec4::Type*, unsigned int, unsigned int, float, float, int) [290]
      

      这是你所有内核的时间。

      运行nvprof --help 并花 5-10 分钟阅读选项也很有用;例如,如果您想在脚本中处理它,您会找到以 CSV 格式打印您的轨迹的开关。

      【讨论】:

        猜你喜欢
        • 2012-04-29
        • 1970-01-01
        • 2020-11-11
        • 2010-09-27
        • 2018-07-09
        • 2013-05-02
        • 1970-01-01
        • 2020-03-12
        • 2021-09-12
        相关资源
        最近更新 更多