我运行每个块一个线程的内核,如<<<NUMBER_OF_BLOCKS, 1>>>
。
在我的GPU上(根据deviceQuery
)我只能运行512个块。因此它应该仅在NUMBER_OF_BLOCKS
&lt; = 512时才有效,但如果运行32768个块,程序仍然有效。当我运行65536个块以及更多时,结果不佳。
我错过了什么?
答案 0 :(得分:2)
我错过了什么?
没有任何地方说你的GPU只能运行512个块。它说你的GPU每个块只能运行512个线程即:
CUDA Device Query (Runtime API) version (CUDART static linking)
There is 1 device supporting CUDA
Device 0: "GeForce 320M"
CUDA Driver Version: 5.0
CUDA Runtime Version: 5.0
CUDA Capability Major/Minor version number: 1.2
Total amount of global memory: 265027584 bytes
Multiprocessors x Cores/MP = Cores: 1 (MP) x 8 (Cores/MP) = 8 (Cores)
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 16384
Warp size: 32
Maximum number of threads per block: 512
Maximum sizes of each dimension of a block: 512 x 512 x 64
Maximum sizes of each dimension of a grid: 65535 x 65535 x 1
Maximum memory pitch: 2147483647 bytes
Texture alignment: 256 bytes
Clock rate: 0.95 GHz
Concurrent copy and execution: Yes
Run time limit on kernels: Yes
Integrated: Yes
Support host page-locked memory mapping: Yes
Compute mode: Exclusive (only one host thread at a time can use this device)
Concurrent kernel execution: Yes
Device has ECC support enabled: No
Device is using TCC driver mode: Yes
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 5.0, CUDA Runtime Version = 5.0, NumDevs = 1, Device = GeForce 320M
所有支持CUDA的GPU可以在每次内核启动时运行最多65535 x 65535个块的网格。较新的设备可以运行更大的网格。