puzzled by the organization of arry in stream

Discussion created by scutan on Jul 5, 2009
Latest reply on Jul 6, 2009 by riza.guntur

When I read the SimpleMatMult example code in SDK, I was puzzled by the organization of array in stream. After thinking for a while, I think I understand it, so the following is what I learned from it. Please tell me am I right? Thanks.

If I declare a 2-D array such as float arr[2][4];

I should declare the Stream as:

unsigned int arr_size[] = {4, 2};

brook::Stream<float> stream_arr(2, arr_size);


And in CPU, the arr[2][4] is organized as :

arr00 arr01 arr02 arr03

arr10 arr11 arr12 arr13

However, in the GPU, the stream_arr is organized as :

arr00 arr10

arr01 arr11

arr02 arr12

arr03 arr13


Also, in kernel function, the range of instance().y is [0, 1] and the range of instance().x is [0, 3]. That is to say, in the kernel function, the instance().y is corresponding to the row of arry in the CPU model.

So, is my description right? Thanks a lot.