更改CUDA中的arch参数使我使用更多寄存器

时间:2013-02-24 15:37:29

标签: cuda nvidia cpu-registers

我一直在我的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?

1 个答案:

答案 0 :(得分:3)

使用sm_20及更高版本进行编译可实现IEEE数学和ABI合规性。这两个选项可能会增加寄存器数量并降低性能。可以禁用这两个选项。