I have a code and It has 3 dimensional array. Can anyone please tell me how to run it in CUDA.

Thanks.

for(int k=0; k<NZ; k++){

for(int j=0; j<NY; j++){

for(int i=0; i<NX; i++){

MM[k*NX*NY+j*NX+i] = A/2+A*i;

NM[k*NX*NY+j*NX+i] = B/2+B*j;

LM[k*NX*NY+j*NX+i] = B/2+B*k;

S[k*NX*NY+j*NX+i] = (bool)(MM[k*NX*NY+j*NX+i]<0.5) & (bool)(NM[k*NX*NY+j*NX+i]<0.5) & (bool)(LM[k*NX*NY+j*NX+i]<0.5);

}

}

}