titanius

Brook+: copying a 1D array to part of a 2D array. Why is this not working?

Discussion created by titanius on Aug 17, 2009
Latest reply on Aug 18, 2009 by titanius

I am trying to update part of a 2D array with a 1D array (basically a row/column of 2D matrix)

 

[Not working Kernel, 1D in 2D]:

kernel void MoveData3_copy(out int aout[][], int ta<>, int index<>, int msh){
    int n;
    aout[msh][index] = ta;
   
}

aout   size:mdim x nsample and i send msh=0 right now for testing.

ta  size:nsample

index = 0...(nsample-1)

Tried aout[msh][index] = ta[index] and so on but nothing works. Only the first index is updated and everything else is garbage.

 

So i tried on with 1D to 1D array and it works!

kernel void MoveData3_copy(out int aout[], int ta<>, int index<>, int msh){
    int n;
    aout[index] = index; // or aout[index]=ta (both works)
   
}

 

So what is the problem with the 2D mapping?

 

Any help is most appreciated.

Outcomes