假设我有一个myapp
不需要命令行参数的可执行文件,并启动一个 CUDA kernel mykernel
。我可以调用:
nv-nsight-cu-cli -k mykernel myapp
并获得如下所示的输出:
==PROF== Connected to process 30446 (/path/to/myapp)
==PROF== Profiling "mykernel": 0%....50%....100% - 13 passes
==PROF== Disconnected from process 1234
[1234] myapp@127.0.0.1
mykernel(), 2020-Oct-25 01:23:45, Context 1, Stream 7
Section: GPU Speed Of Light
--------------------------------------------------------------------
Memory Frequency cycle/nsecond 1.62
SOL FB % 1.58
Elapsed Cycles cycle 4,421,067
SM Frequency cycle/nsecond 1.43
Memory [%] % 61.76
Duration msecond 3.07
SOL L2 % 0.79
SM Active Cycles cycle 4,390,420.69
(etc. etc.)
--------------------------------------------------------------------
(etc. etc. - other sections here)
到目前为止,一切都很好。mykernel
但是现在,我只想要- 而没有其他输出的整体内核持续时间。看着nv-nsight-cu-cli --query-metrics
,我看到,除其他外:
gpu__time_duration incremental duration in nanoseconds; isolated measurement is same as gpu__time_active
gpu__time_active total duration in nanoseconds
所以,它一定是其中之一,对吧?但是当我跑步时
nv-nsight-cu-cli -k mykernel myapp --metrics gpu__time_duration,gpu__time_active
我得到:
==PROF== Connected to process 30446 (/path/to/myapp)
==PROF== Profiling "mykernel": 0%....50%....100% - 13 passes
==PROF== Disconnected from process 12345
[12345] myapp@127.0.0.1
mykernel(), 2020-Oct-25 12:34:56, Context 1, Stream 7
Section: GPU Speed Of Light
Section: Command line profiler metrics
---------------------------------------------------------------
gpu__time_active (!) n/a
gpu__time_duration (!) n/a
---------------------------------------------------------------
我的问题:
- 为什么我得到“n/a”值?
- 我怎样才能得到我所追求的实际价值,而不是别的?
备注::
- 我将 CUDA 10.2 与 NSight Compute 版本 2019.5.0(内部版本 27346997)一起使用。
- 我意识到我可以过滤不合格调用的标准输出流,但这不是我想要的。
- 我实际上只想要原始数字,但我愿意接受并使用
--csv
最后一个字段。 - 在nvprof 过渡指南中找不到任何相关内容。