我看到 nvprof 可以分析内核中的 flop 数量(使用如下参数)。此外,当我浏览文档时(这里http://docs.nvidia.com/cuda ...它说 flop_count_sp 是“非谓词线程执行的单精度浮点运算数(加、乘、乘-累加和特殊)。每个乘法累加操作对计数贡献 2。
但是,当我运行时,flop_count_sp
(应该是flop_count_sp_add
+ flop_count_sp_mul
+ flop_count_sp_special
+ 2 * flop_count_sp_fma
)的结果我发现它的总和中不包括flop_count_sp_special
.
你能建议我应该使用什么吗?我应该将此值添加到总和中flop_count_sp
还是应该考虑公式不包含 的值flop_count_sp_special
?
另外你能告诉我这些特殊操作是什么吗?
我正在使用以下命令行:
nvprof --metrics flops_sp --metrics flops_sp_add --metrics flops_sp_mul --metrics flops_sp_fma --metrics flops_sp_special myKernel args
我的 CUDA 内核的名称在哪里myKernel
,它有一些由 args 给出的输入参数。
例如,我的 nvprof 输出的一部分如下所示:
==20549== Profiling result:
==20549== Metric result:
Invocations Metric Name Metric Description Min Max Avg
Device "Tesla K40c (0)"
Kernel: mykernel(float*, int, int, float*, int, float*, int*)
2 flop_count_sp Floating Point Operations(Single Precisi 70888 70888 70888
2 flop_count_sp_add Floating Point Operations(Single Precisi 14465 14465 14465
2 flop_count_sp_mul Floating Point Operation(Single Precisio 14465 14465 14465
2 flop_count_sp_fma Floating Point Operations(Single Precisi 20979 20979 20979
2 flop_count_sp_special Floating Point Operations(Single Precisi 87637 87637 87637