-8

我像这样运行每个块一个线程的内核<<<NUMBER_OF_BLOCKS, 1>>>

在我的 GPU(根据deviceQuery)上,我只能运行 512 个块。所以它应该只在NUMBER_OF_BLOCKS<= 512 时才有效,但如果我运行 32768 个块,程序仍然有效。当我运行 65536 个块等时,结果显示不好。

我错过了什么?

4

1 回答 1

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 块的网格。较新的设备可以运行比这更大的网格。

于 2013-08-05T18:51:41.373 回答