mattscar

Aparapi and Work-Groups

Discussion created by mattscar on Jan 17, 2011
Latest reply on Feb 17, 2011 by mattscar
Having a problem with getLocalId()

I'm trying to code an Aparapi kernel with 8 work-items and 4 work-groups. I call setSizes(8, 4) and kernel.execute(8), but when I call getLocalId, the numbers vary from 0 to 7 instead of 0 to 4.

 

My code is attached. If I'm doing something wrong, please let me know.

package aparapiTest; import com.amd.aparapi.Kernel; public class AparapiItems { public static void main(String[] args) { final int numItems = 8; final int numGroups = 4; final float[] itemInfo = new float[numItems]; Kernel kernel = new Kernel(){ public void setSizes(int gSize, int lSize) { super.setSizes(numItems, numGroups); } public void run() { itemInfo[getGlobalId()] = getGlobalId() * 10.0f + getGlobalSize() + getLocalId() * 0.1f + getLocalSize() * 0.01f; } }; kernel.execute(numItems); for(int i=0; i<numItems; i++) System.out.println(itemInfo[i]); } }

Outcomes