Saturday 3 June 2017

What is dim3 in Cuda?


 1. dim3 is data type used to define multi dimensional block or grid.

2. It accepts 3 arguments. e.g. dim3 var(z,y,x). We can also provide 1 or 2 arguments like dim3 var(y,x) or dim3 var(x). If we are providing less than 3 arguments, then others are considered to be 1.

3. Variable defined by dim3 is used in kernel invocation.

4. e.g.
dim3 grid(3,2)
kernelname<<<grid,1>>>(arg1,arg2,arg3);

dim3 block(2,4)
kernelname<<<1,block>>>(arg1,arg2,arg3);

dim3 grid(2,3)
dim3 block(3,2)
kernelname<<<grid,block>>>(arg1,arg2,arg3);

No comments:

Post a Comment