Please help me to resolve this error, i am new to cuda programming.

error i am facing is :

Invalid **global** read of size 8

========= at 0x00000d38 in mom(double[52][52]*, double[52][52]*, double[52][52]*, double[52][52]*, double[52][52]*, double[52][52]*, double[52][52]*, double[52][52]*, double[52][52]*, double[52][52]*)

========= by thread (0,2,1) in block (0,0,0)

========= Address 0x40107aec8 is out of bounds

I am doing operations on 3d array in cuda kernel with 3d Indexing. I have calculated indexs in following way

```
int i = blockDim.x * blockIdx.x + threadIdx.x;
int j = blockDim.y * blockIdx.y + threadIdx.y;
int k = blockDim.z * blockIdx.z + threadIdx.z; and
```

dim3 dimBlock(4,4,4);

dim3 dimGrid(idivup(n+2,BLKXSIZE), idivup(m+2,BLKYSIZE), idivup(l+2,BLKYSIZE));

where

idivup is

#define idivup(a, b) ( ((a)%(b) != 0) ? (a)/(b)+1 : (a)/(b) )