Dynamicaly allocating local memory

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamicaly allocating local memory

Miha
Hello,

how can I dynamicaly allocate local memory from java code prior to calling kernel?

So I am looking for JOCL equivalent of:

clSetKernelArg(kernel, 3, array_size*sizeof(int), NULL);

// CL kernel
__kernel void test(__global int **values, __global int *result,  const int array_size, __local int * cache)

Reply | Threaded
Open this post in threaded view
|

Re: Dynamicaly allocating local memory

Wade Walker
Administrator
Looks like it should just be something like this:

CL cl = CLPlatform.getLowLevelCLInterface();
...
cl.clSetKernelArg(kernel, 3, bytes, null);

You can look in https://github.com/JogAmp/jocl/blob/master/test/com/jogamp/opencl/LowLevelBindingTest.java for an example of clSetKernelArg().
Reply | Threaded
Open this post in threaded view
|

Re: Dynamicaly allocating local memory

Miha
Thank you, this works well.