A noob need help
global void square_array(float *a, int N)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx<N) a[idx] = a[idx] * a[idx];
}
square_array <<< 3, 4 >>> (a_d, N);
I need help for this code segment:
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx<N) a[idx] = a[idx] * a[idx];
N = 10
Can you explain the two codelines for me.