CUDA to OpenCL : What is the equivalent of (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x in OpenCL?

Viewed 1915

I'm a beginner in OpenCL, trying to convert a simple CUDA function to OpenCL. In the CUDA function they've used the below snippet to get the index of operations,

int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;

Is get_global_id(0) the equivalent of the above in OpenCL?

int id = get_global_id(0);
1 Answers
Related