【发布时间】:2013-02-25 23:40:41
【问题描述】:
我一直在我的 Tesla K20m 上编写内核,当我使用 -Xptas=-v 编译软件时,我得到以下结果:
ptxas info : 0 bytes gmem
ptxas info : Compiling entry function '_Z9searchKMPPciPhiPiS1_' for 'sm_10'
ptxas info : Used 8 registers, 80 bytes smem, 8 bytes cmem[1]
如您所见,只使用了 8 个寄存器,但是,如果我提到参数 -arch=sm_35,我的内核执行时间会显着增加,并且使用的寄存器数量也会增加,我想知道为什么
nvcc mysoftware.cu -Xptxas=-v -arch=sm_35
ptxas info : 0 bytes gmem
ptxas info : Compiling entry function '_Z9searchKMPPciPhiPiS1_' for 'sm_35'
ptxas info : Function properties for _Z9searchKMPPciPhiPiS1_
0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info : Used 21 registers, 16 bytes smem, 368 bytes cmem[0]
由于在多本书中都提到使用正确的卡架构可以提高性能,我想知道为什么我的卡会急剧下降。
谢谢。
编辑: 类似问答:Registers and shared memory depending on compiling compute capability?
【问题讨论】:
-
编译器似乎做出了不同的优化决策。你能提供你所看到的简短的可编译复制器吗?我对资源使用的变化没有你所报告的急剧放缓那么感兴趣。
-
所以基本上,当我使用 'sm_10' 时,代码需要 2.000235 毫秒才能执行,但是当使用 'sm_35" 时,代码需要 2.538336 到 3.xxxxxx 毫秒,这在这个内核的情况下令人印象深刻。
-
我现在实际上不能给出代码,它使用了一部分不是我的代码。
-
可能是编译器错误,但如果没有源代码,则无法确定。尝试指定
__launch_bounds__(尝试不同的值),看看是否有什么不同。 -
我实际上使用了定义数量的线程和固定数量的块,所以尝试 launch_bounds 是否重要?
标签: cuda nvidia cpu-registers