Friday, 2 June 2017

How kernels are called from main() function?


 Syntax: 

kernel-name<<<No-of-Blocks, No-of-Threads-Per_Block>>>(Parameters)

Explanation:
                 Look at the above syntax. In between, kernel name and parameters, we have to mention triple angular brackets. In triple angular brackets, two parameters are their. First parameter indicates number of blocks while second parameter indicates number of threads per block.

e.g. 

__global__ void func1(int *a, int *b)
  {
     func2(); 
  }

void main()
  {
    func1<<<1,2>>>(d,e);
  }

No comments:

Post a comment