Hello everyone,
I would like to request some help from you. First of all, I am, by no means, a good programmer.I am trying to phase unwrapping in open Cl. I do not understand the difference between get_global_id(0) & get_global_size? And also in the following code why:
int stride = cols * get_global_size(0); // why it is multiplied by cols
int row_start = cols * get_global_id(0);// why it is multiplied by cols
and what is the exact meaning of this array indexing phase[stride + row_start + i] ?
Would anyone able to clearly explain me the way array has been indexed here and also the concept of get_global_id(0) & get_global_size? I have tried to use google and also read a book. but failed to understand clearly.
Thank you.
Code:
__kernel void unwrap_rows_new (__global Scalar *phase, __global char *mask, int cols)
// must be lunched rows times (for each row)
{
int stride = cols * get_global_size(0);
int row_start = cols * get_global_id(0);
int i;
Scalar Jump = 0;
for (i = 1; i<cols; i ++)
// if (mask )
{
if (phase[row_start + i] - phase[row_start + i - 1] > M_PI) Jump -= 2 * M_PI;
else if (phase[row_start + i] - phase[row_start + i - 1] < - M_PI) Jump += 2 * M_PI;
phase[stride + row_start + i] = phase[row_start + i] + Jump;
}
}