opencl Kernel ID


Example

To properly work with the data each thread needs to know its position in the threadblock/global thread pool. This can be archieved with

get_local_id($dim);
get_global_id($dim);

Those two functions return the position of the thread relative to the threadblock or all threads.

get_working_dim();

Gets the total number of dimensions the kernel was launched with.

get_local_size($dim);
get_global_size($dim);

Gets the total number of threads in the threadblock or in total for a given dimension.

Caveat: make always sure that your thread is not exceeding your data size. This is very likely to happen and should always be checked for.