【问题标题】:How to collect the event value every time the CUDA kernel function been invoked with nvprof?每次使用 nvprof 调用 CUDA 内核函数时如何收集事件值?
【发布时间】:2018-07-11 15:14:13
【问题描述】:

使用 nvprof 分析 CUDA 程序。

我已经在How to collect the event value every time the kernel function been invocated?描述了这个问题

我再次发布问题。

nvprof --events tex0_cache_sector_queries --replay-mode kernel ./matrixMul

nvprof --events tex0_cache_sector_queries --replay-mode application ./matrixMul

我们可以收集事件值结果:

==40013== Profiling application: ./matrixMul
==40013== Profiling result:
==40013== Event result:
"Device","Kernel","Invocations","Event Name","Min","Max","Avg","Total"
"Tesla K80 (0)","void matrixMulCUDA<int=32>(float*, float*, float*, int, int)",301,"tex0_cache_sector_queries",0,30,24,7224

上面的结果是一个摘要。核函数matrixMulCUDA调用tex0_cache_sector_queries的301次调用值。它只有 301 次调用的 min, max, avg, total 值,即汇总结果。

我想从每次调用 matrixMulCUDA 时收集完整的 301 次 tex0_cache_sector_queries 值。另一方面,每次调用内核函数 matrixMulCUDA 时,我都想收集 tex0_cache_sector_queries 事件值。如何收集?

【问题讨论】:

    标签: cuda nvprof


    【解决方案1】:

    1 次运行:

    nvprof --pc-sampling-period 31 --print-gpu-trace --replay-mode application \
    --export-profile application.prof --events tex0_cache_sector_queries ./matrixMul
    

    2 将 application.prof 导入可视分析器:

    visual profiler result

    3 按照图片上的索引获取每个内核函数的每次调用事件值。

    4 --print-gpu-trace 参数:打印单个内核调用(包括 CUDA memcpy's/memset's)并按时间顺序对它们进行排序。在事件/指标分析模式下,显示每个内核调用的事件/指标可以解决此问题。 print-gpu-trace

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-26
      • 1970-01-01
      • 1970-01-01
      • 2014-09-02
      • 1970-01-01
      • 2011-08-08
      • 1970-01-01
      • 2012-04-13
      相关资源
      最近更新 更多