Complete syntax of CUDA Kernels
GPU Kernel with Streams, Run time Kernel Launch
In this article we’ll let you
know the complete syntax of CUDA Kernels.
We all are love to learn and
always curious about know everything in detail. I was very disappointed when I was
not able to find the complete syntax of CUDA Kernels. So, I though let me give
it a day to search everywhere, after the havey search, I found the syntax of
CUDA Kernel and today I am presenting It you reader.
The CUDA Kernel consist in
<<< >>> brackets four things.
First argument is known as “Grid
Size”, followed by “Block Size”, followed by size of “Shared Memory” and end
with “Stream argument”.
Here is the complete syntax;
Kernel_Name<<< GridSize, BlockSize,
SMEMSize, Stream >>> (arguments,....);
|
Grid Size
We all know what is Grid size, in case you don’t know read further.
Grid size is defined by the number of blocks in a grid. In previous version
of CUDA architecture (from Compute
capability 1.x to 2.x) the grid can only be organized in two dimension (X
and Y direction ). But in the current version (from Compute
capability 3.x onwards) the grid can be organized in three dimension ( X ,
Y and Z all ).
Block Size
The blocks organized in terms of threads. Threads is the smallest unit in
Parallel programming so in CUDA.
Shared Memory (SMEMSize)
This is for the size of shared memory which is to be use in CUDA Kernel for
shared variable space. This is use bec. Of dynamic shared memory size in CUDA
Kernels.
Streams
A stream is a sequence of operations that are performed
in order on the device.
Streams allows independent concurrent in-order queues of
execution. Stream tell on which device,
kernel will execute.
Operations in different streams can be interleaved and
overlapped, which can be used to hide data transfers between host and device.
Learn more about CUDA Streams follow this article
Learn more about CUDA Streams follow this article
Got Questions?
Feel free to ask me any
question because I'd be happy to walk you through step by step!
References and External links
I was looking for this..... Thanks mate
ReplyDeleteWelcome ... keep visiting :)
Delete