我有一个在 680gtx 上运行的 cuda 程序,在测试不同的编译器选项时,我注意到:
为计算能力 1.0 和 sm 1.0 编译我的代码给出了 47ms 的运行时间
为计算能力 3.5(也是 2.0)和 sm 3.0 编译我的代码,运行时间为 60 毫秒
出现这种结果的原因可能是什么?
我在 linux 和 CUDA 5.0 上编译 nsight 编译器,我的内核主要是内存绑定的。
谢谢。
命令:
抄送 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"
抄送 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"
有关编译我的内核的更多信息:
抄送 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
抄送 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]