Barsik107

2 dimentions memory

Discussion created by Barsik107 on Dec 16, 2010
Latest reply on Dec 21, 2010 by Barsik107

I need to use some kind of two dimension memory and I don't know exactly how to create and work with it. I tried to use smth like this

lEnqueueNDRangeKernel(commandQueue,kernelTay,1,NULL,

globalThreads,localThreads,0,NULL,&events[0]);

where globalThreads = {200,200} and localThreads = {1} for example.

Incide kernel i tried to calculate index like this:

 

uint tid = get_global_id(0);

uint lid = get_global_id(1);

uint index;

const uint range=200;

index = tid*range+lid;

But seems that it's wrong, because if I tried to save indexes like this:

 

input_Tay[index]=index; 

then only one of 200 elements of input_Tay has nonzero value. And this values like 200,400,600 and so on. I donk know what to think about this. Maybe somebody have example of how to use 2 dimension memory?





Outcomes