how to make idx+=gridDim.x*blockDim.x; in matrix

hi everyone, i am a new user in cuda. I know idx+=gridDim.x*blockDim.x; can be used in vector adder.But could you tell me how to make the same function in matrix add?

an elementwise matrix add can be done in an identical fashion to vector add. The construct you have shown is for a grid-striding loop, and does not depend on the dimensions of the matrix or vector