CUDA thread execution order

后端 未结 2 1564
野的像风
野的像风 2021-01-23 06:49

I have the following code for a CUDA program:

#include 

#define NUM_BLOCKS 4
#define THREADS_PER_BLOCK 4

__global__ void hello()
{  

   printf(         


        
2条回答
  •  迷失自我
    2021-01-23 07:41

    To answer the second part of your question, when control flow diverges at the if statement, the threads where threadIdx.x != 0 simply wait to at the convergence point after the if statement. They do not go on to the printf statement until thread 0 has completed the if block.

提交回复
热议问题