To properly work with the data each thread needs to know its position in the threadblock/global thread pool. This can be archieved with
Those two functions return the position of the thread relative to the threadblock or all threads.
Gets the total number of dimensions the kernel was launched with.
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.