Does __syncthreads() synchronize all threads in the grid?

前端 未结 5 1057
栀梦
栀梦 2021-02-02 05:43

...or just the threads in the current warp or block?

Also, when the threads in a particular block encounter (in the kernel) the following line

__shared__         


        
5条回答
  •  被撕碎了的回忆
    2021-02-02 06:21

    __syncthreads() waits until all threads within the same block has reached the command and all threads within a warp - that means all warps that belongs to a threadblock must reach the statement.

    If you declare shared memory in a kernel, the array will only be visible to one threadblock. So each block will have his own shared memory block.

提交回复
热议问题