aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-01-12 19:53:13 +0100
committerMichael Bien <[email protected]>2010-01-12 19:53:13 +0100
commit3d01c2c74e282c19e9286d4f4509bef8302ca93e (patch)
treee9f6e0da1877776ca9851600d1f6e02ba189cfd1 /test
parent286f94a7b148856666d7c05853ba9b2ba799b638 (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')
-rw-r--r--test/com/mbien/opencl/HighLevelBindingTest.java2
-rw-r--r--test/com/mbien/opencl/LowLevelBindingTest.java15
2 files changed, 8 insertions, 9 deletions
diff --git a/test/com/mbien/opencl/HighLevelBindingTest.java b/test/com/mbien/opencl/HighLevelBindingTest.java
index 42e74667..5515cecc 100644
--- a/test/com/mbien/opencl/HighLevelBindingTest.java
+++ b/test/com/mbien/opencl/HighLevelBindingTest.java
@@ -153,7 +153,7 @@ public class HighLevelBindingTest {
// Asynchronous write of data to GPU device, blocking read later
queue.putWriteBuffer(clBufferA, false)
.putWriteBuffer(clBufferB, false)
- .putNDRangeKernel(vectorAddKernel, 1, null, new long[]{ globalWorkSize }, new long[]{ localWorkSize })
+ .put1DRangeKernel(vectorAddKernel, 0, globalWorkSize, localWorkSize)
.putReadBuffer(clBufferC, true)
.finish().release();
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: ");