osx - Aparapi add sample -


i'm studing aparapi (https://code.google.com/p/aparapi/) , have strange behaviour of 1 of sample included. sample first, "add". building , executing it, ok. put following code testing if gpu used

if(!kernel.getexecutionmode().equals(kernel.execution_mode.gpu)){     system.out.println("kernel did not execute on gpu!"); } 

and works fine. but, if try change size of array 512 number greater 999 (for example 1000), have following output:

!!!!!!! clenqueuendrangekernel() failed invalid work group size after clenqueuendrangekernel, globalsize[0] = 1000, localsize[0] = 128 apr 18, 2013 1:31:01 pm com.amd.aparapi.kernelrunner executeopencl warning: ### cl exec seems have failed. trying revert java ### jtp  kernel did not execute on gpu! 

here's code:

  final int size = 1000;    final float[] = new float[size];   final float[] b = new float[size];    (int = 0; < size; i++) {      a[i] = (float)(math.random()*100);      b[i] = (float)(math.random()*100);   }    final float[] sum = new float[size];    kernel kernel = new kernel(){      @override public void run() {         int gid = getglobalid();         sum[gid] = a[gid] + b[gid];      }   };    range range = range.create(size);   kernel.execute(range);    system.out.println(kernel.getexecutionmode());   if (!kernel.getexecutionmode().equals(kernel.execution_mode.gpu)){      system.out.println("kernel did not execute on gpu!");   }    kernel.dispose(); 

}

i tried specifying size using

range range = range.create(size, 128); 

as suggested in google group, nothing changed.

i'm running on mac os x 10.8 java 1.6.0_43. aparapi version latest (2012-01-23).

am missing something? ideas?

thanks in advance

aparapi inherits 'grid style' of implementation opencl. when specify range of execution (say 1024), opencl break 'range' groups of equal size. possibly 4 groups of 256, or 8 groups of 128.

the group size must factor of range (so assert(range%groupsize==0)).

by default aparapi internally selects group size.

but choosing specify range , group size using

range r= range.range(n,128)

you responsible ensuring n%128==0.

from error, looks chose range.range(1000,128).

sadly 1000 % 128 != 0 range fail.

if specifiy

range r = range.range(n)

aparapi choose valid group size, finding highest common factor of n.

try dropping 128 the second arg.

gary


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -