diff options
author | Michael Bien <[email protected]> | 2010-01-12 19:53:13 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-01-12 19:53:13 +0100 |
commit | 3d01c2c74e282c19e9286d4f4509bef8302ca93e (patch) | |
tree | e9f6e0da1877776ca9851600d1f6e02ba189cfd1 /test/com/mbien/opencl/LowLevelBindingTest.java | |
parent | 286f94a7b148856666d7c05853ba9b2ba799b638 (diff) |
introduced CLEventList, an optimized nio collecton for storing CLEvents.
added hashCode() and equals() to CLEvent.
CLEvent support in CLCommandQueue.
Several NIO optimizations.
Diffstat (limited to 'test/com/mbien/opencl/LowLevelBindingTest.java')
-rw-r--r-- | test/com/mbien/opencl/LowLevelBindingTest.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/test/com/mbien/opencl/LowLevelBindingTest.java b/test/com/mbien/opencl/LowLevelBindingTest.java index 0a600102..94b86e71 100644 --- a/test/com/mbien/opencl/LowLevelBindingTest.java +++ b/test/com/mbien/opencl/LowLevelBindingTest.java @@ -1,6 +1,7 @@ package com.mbien.opencl; import com.sun.gluegen.runtime.CPU; +import com.sun.gluegen.runtime.PointerBuffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; @@ -289,21 +290,19 @@ public class LowLevelBindingTest { out.println("used device memory: "+ (srcA.capacity()+srcB.capacity()+dest.capacity())/1000000 +"MB"); // Asynchronous write of data to GPU device - ret = cl.clEnqueueWriteBuffer(commandQueue, devSrcA, CL.CL_FALSE, 0, srcA.capacity(), srcA, 0, null, 0, null, 0); + ret = cl.clEnqueueWriteBuffer(commandQueue, devSrcA, CL.CL_FALSE, 0, srcA.capacity(), srcA, 0, null, null); checkError("on clEnqueueWriteBuffer", ret); - ret = cl.clEnqueueWriteBuffer(commandQueue, devSrcB, CL.CL_FALSE, 0, srcB.capacity(), srcB, 0, null, 0, null, 0); + ret = cl.clEnqueueWriteBuffer(commandQueue, devSrcB, CL.CL_FALSE, 0, srcB.capacity(), srcB, 0, null, null); checkError("on clEnqueueWriteBuffer", ret); // Launch kernel - ret = cl.clEnqueueNDRangeKernel(commandQueue, kernel, 1, null, 0, - new long[]{ globalWorkSize }, 0, - new long[]{ localWorkSize }, 0, 0, - null, 0, - null, 0); + PointerBuffer gWS = PointerBuffer.allocateDirect(1).put(globalWorkSize).rewind(); + PointerBuffer lWS = PointerBuffer.allocateDirect(1).put(localWorkSize).rewind(); + ret = cl.clEnqueueNDRangeKernel(commandQueue, kernel, 1, null, gWS, lWS, 0, null, null); checkError("on clEnqueueNDRangeKernel", ret); // Synchronous/blocking read of results - ret = cl.clEnqueueReadBuffer(commandQueue, devDst, CL.CL_TRUE, 0, dest.capacity(), dest, 0, null, 0, null, 0); + ret = cl.clEnqueueReadBuffer(commandQueue, devDst, CL.CL_TRUE, 0, dest.capacity(), dest, 0, null, null); checkError("on clEnqueueReadBuffer", ret); out.println("a+b=c result snapshot: "); |