cupyx.jit.grid

cupyx.jit.grid = <cupyx.jit._builtin_funcs.GridFunc object>

Compute the thread index in the grid.

Computation of the first integer is as follows:

jit.threadIdx.x + jit.blockIdx.x * jit.blockDim.x

and for the other two integers the y and z attributes are used.

Parameters

ndim (int) – The dimension of the grid. Only 1, 2, or 3 is allowed.

Returns

If ndim is 1, an integer is returned, otherwise a tuple.

Return type

int or tuple

Note

This function follows the convention of Numba’s numba.cuda.grid.