Hi,
While using the clEnqueueNDRangeKernel (with 3 dimensional kernel) i got following exception, I have created a PointerBuffer and passed an array in this buffer, then the pointer buffer is passed to the "putNDRangeKernel" call. What mistake am i doing here?? Code sample: PointerBuffer offSets = PointerBuffer.allocate(1); offSets.put(globalWorkOffsets, 0, 1); .... device.getCommandQueue().putNDRangeKernel(clkernel, 3, offSets, globalSizes, localSizes); com.jogamp.opencl.CLException: Argument "global_work_offset" was not a direct buffer at com.jogamp.opencl.impl.CLAbstractImpl.clEnqueueNDRangeKernel(CLAbstractImpl.java:707) at com.jogamp.opencl.CLCommandQueue.putNDRangeKernel(CLCommandQueue.java:1544) |
replace
PointerBuffer.allocate(1); with PointerBuffer.allocateDirect(1); and don't forget to rewind the buffer (hmm maybe we should add a utility 3D method like the 1D and 2D methods) -michael On 04/21/2011 04:54 PM, suleman [via jogamp] wrote: > > Hi, > > While using the clEnqueueNDRangeKernel (with 3 dimensional kernel) i got > following exception, > I have created a PointerBuffer and passed an array in this buffer, then the > pointer buffer is passed to the "putNDRangeKernel" call. What mistake am i > doing here?? > > Code sample: > > PointerBuffer offSets = PointerBuffer.allocate(1); > offSets.put(globalWorkOffsets, 0, 1); > .... > device.getCommandQueue().putNDRangeKernel(clkernel, > 3, offSets, globalSizes, localSizes); > > > > com.jogamp.opencl.CLException: Argument "global_work_offset" was not a > direct buffer > at > com.jogamp.opencl.impl.CLAbstractImpl.clEnqueueNDRangeKernel(CLAbstractImpl.java:707) > at > com.jogamp.opencl.CLCommandQueue.putNDRangeKernel(CLCommandQueue.java:1544) > > > _______________________________________________ > If you reply to this email, your message will be added to the discussion below: > http://forum.jogamp.org/Exception-while-executing-a-3D-kernel-tp2847306p2847306.html > To start a new topic under jogamp, email [hidden email] > To unsubscribe from jogamp, visit http://michael-bien.com/ |
Thanks a lot for quick responce
yes, it will be nice if you add a utility function also for 3D kernels. |
Hi,
I changed the code assaid by you, but now the JVM crashes? Is there a bug in the implementation (by me or jocl library) or do i have a older version? Currently i am using (08-03-2011) version PointerBuffer offSets = PointerBuffer.allocateDirect(1); offSets.put(globalWorkOffsets,0,1); offSets.rewind(); PointerBuffer globalSizes = PointerBuffer.allocateDirect(1); globalSizes.put(globalWorkSizes, 0, 1); globalSizes.rewind(); PointerBuffer localSizes = PointerBuffer.allocateDirect(1); localSizes.put(localWorkSizes, 0, 1); localSizes.rewind(); //Execute the 3D kernel device.getCommandQueue().putNDRangeKernel(clkernel, 3, offSets, globalSizes, localSizes); |
if you use a 3d kernel all offsets and sizes must be 3 element vectors.
PointerBuffer offsets = PointerBuffer.allocateDirect(new long[]{first, second, third}); or offsets.put(first).put(second).put(third).rewind(); rewind puts the read/write index to 0. The first method does that automatically. You don't have to rewind if you address the position via a index. e.g: .put(0, first); offSets.put(globalWorkOffsets,0,1); inserts only the first element since the lenght was set to 1. -michael On 04/21/2011 05:49 PM, suleman [via jogamp] wrote: > > Hi, > > I changed the code assaid by you, but now the JVM crashes? Is there a bug in > the implementation (by me or jocl library) or do i have a older version? > Currently i am using (08-03-2011) version > > > PointerBuffer offSets = PointerBuffer.allocateDirect(1); > offSets.put(globalWorkOffsets,0,1); > offSets.rewind(); > > PointerBuffer globalSizes = PointerBuffer.allocateDirect(1); > globalSizes.put(globalWorkSizes, 0, 1); > globalSizes.rewind(); > > PointerBuffer localSizes = PointerBuffer.allocateDirect(1); > localSizes.put(localWorkSizes, 0, 1); > localSizes.rewind(); > > //Execute the 3D kernel > device.getCommandQueue().putNDRangeKernel(clkernel, 3, offSets, > globalSizes, localSizes); > > _______________________________________________ > If you reply to this email, your message will be added to the discussion below: > http://forum.jogamp.org/Exception-while-executing-a-3D-kernel-tp2847306p2847490.html > To start a new topic under jogamp, email [hidden email] > To unsubscribe from jogamp, visit |
Free forum by Nabble | Edit this page |