2D arrays, pointers to pointers

I know that allocating 2d arrays on the GPU that can be indexed in the form [i]array[j] isn’t particularly fast due to the double pointers, but I need to know how to allocate an array in this manner so I can demonstrate how slow it is compared to flattening it into a 1D array. Does anyone have a simple example of allocating and copying to/from a 2d array to the GPU that can be indexed in the conventional 2D manner? A forum search has yielded nothing except 'flatten it into a 1D array". Thanks.

Sorry, double post. Please delete this.