This isn’t necessarily CUDA specific.
Basically, on the GPU I have a 1D array, but in the C code, I have a 3d array. I need to copy this array back and forth, and I need to be able to linear-ize the indices properly. That means that I have the pick the correct numbering scheme, as in is (1, 0, 0) linear-ized as 1, or is (0, 1, 0), or (0, 0, 1), in the form (x, y, z)?
The 3d arrays are declared as array[X][Y][Z]. When I copy that 3D array into an equal sized 1d array, how will the computer naturally number it? However the computer collapses down the 3d array, I need to do the exact same when I try to convert between the two. I hope I am making clear what I want to say, but if you have any questions, please ask. Thank you.
Arrays in C are kept in row-major order, see this for more details.
So the first element is
array[0][0][0], the second isarray[0][0][1], and etc.