Friday, 2 June 2017

What is kernel in Cuda?



            A function(in C/C++ language) to be executed on GPU is called a Kernel. While defining kernel, a function is prefixed with keyword __global__.
e.g.
 __global__ void matadd(int *a,int *b)
{
//code to be executed on GPU
}

Here matadd() is a kernel.


Note: Only those kernels, which are called from cpu function(e.g. main() funtion), are prefixed with __global__ during their definition while kernels which are called from another kernel, are prefixed with __device__ during their definition.

No comments:

Post a comment