I'm new in CUDA, and cannot understand what I'm doing wrong.
I'm trying to calculate the distance of object it has id in array, axis x in array and axis y in array to find neighbors for each object
__global__
void dist(int *id_d, int *x_d, int *y_d,
int *dist_dev, int dimBlock, int i)
{
int idx = threadIdx.x + blockIdx.x*blockDim.x;
while(idx < dimBlock){
int i;
for(i= 0; i< dimBlock; i++){
if (idx == i)continue;
dist_dev[idx] = pow(x_d[idx] - x_d[i], 2) + pow(y_d[idx] - y_d[i], 2); // error here
}
}
}
Is pow
not defined in kernel code?