Indexes in Kernel's

Discussion created by Barsik107 on Oct 21, 2010
Latest reply on Oct 21, 2010 by douglas125

I want to count some array which have 40000 items. But I'm thinking of it like 2 dimensional(200x200). So I set the   globalThreads[0] = 200;
  localThreads[0] = 200. Then using the simple logic, I calculating index in kernel like: 

uint tid = get_global_id(0);
 uint lid = get_local_id(0);

const uint range=200;

index= tid*range+lid;

But seems that it wrong idea. What's wrong in my logic?