【发布时间】:2013-05-03 07:15:03
【问题描述】:
我有一个在 680gtx 上运行的 cuda 程序, 在测试不同的编译器选项时,我注意到:
为计算能力 1.0 和 sm 1.0 编译我的代码给出了一个 运行时间 47 毫秒
为计算能力 3.5(也是 2.0)和 sm 3.0 编译我的代码给出了 运行时间 60 毫秒
出现这种结果的原因可能是什么?
我在 linux 和 CUDA 5.0 上使用 nsight 编译器进行编译 而且我的内核主要受内存限制。
谢谢。
命令:
cc 1.0
nvcc --compile -O0 -Xptxas -v -gencode arch=compute_10,code=compute_10 -gencode arch=compute_10,code=sm_10 -keep -keep-dir /tmp/debug -lineinfo -pg -v -x cu -o "BenOlaCuda/src/main.o" "../BenOlaCuda/src/main.cu"
cc 3.0
nvcc -lineinfo -pg -O0 -v -keep -keep-dir /tmp/debug -Xptxas -v -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -odir "BenOlaCuda/src" -M -o "BenOlaCuda/src/main.d" "../BenOlaCuda/src/main.cu"
关于编译我的内核的更多信息:
cc 1.0
ptxas info : Compiling entry function '_Z15optimizePixelZ3tfPfS_S_S_tttttt' for 'sm_10'
ptxas info : Used 40 registers, 68 bytes smem, 64 bytes cmem[1], 68 bytes lmem
cc 3.0
ptxas info : Compiling entry function '_Z15optimizePixelZ3tfPfS_S_S_tttttt' for 'sm_30'
ptxas info : Function properties for _Z15optimizePixelZ3tfPfS_S_S_tttttt
128 bytes stack frame, 100 bytes spill stores, 108 bytes spill loads
ptxas info : Used 63 registers, 380 bytes cmem[0], 20 bytes cmem[2]
【问题讨论】:
-
sm 1.0与sm 3.5问题不谈,避免像那样溢出到堆栈框架可能是个好主意。也许删除一些循环展开或类似的东西?
标签: cuda gpgpu nvidia compiler-optimization nsight