summaryrefslogtreecommitdiffstats
path: root/test/com/jogamp/opencl
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-05-25 00:50:26 +0200
committerMichael Bien <[email protected]>2011-05-25 00:50:26 +0200
commitcb859fd580d3e1f5afb3c0f77cee0a5e82a394bb (patch)
tree45fe2c5c38c295cac727a65606aef43545c43d53 /test/com/jogamp/opencl
parent10c82cf73a2c2e4a944d10294b7d51f4575e0f6e (diff)
fixed event-condition test which failed sporadically with out-of-order queues.
Diffstat (limited to 'test/com/jogamp/opencl')
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index c8c028af..5636a40d 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -191,25 +191,24 @@ public class CLCommandQueueTest {
}else{
queue = device.createCommandQueue();
}
-
- CLEventList writeEvent = new CLEventList(1);
- CLEventList kernelEvents = new CLEventList(2);
+
+ // simulate in-order queue by accumulating events of prior commands
+ CLEventList events = new CLEventList(3);
// (1+1)*2 = 4; conditions enforce propper order
CLKernel addKernel = program.createCLKernel("add").putArg(buffer).putArg(1).putArg(elements);
CLKernel mulKernel = program.createCLKernel("mul").putArg(buffer).putArg(2).putArg(elements);
- queue.putWriteBuffer(buffer, false, writeEvent);
+ queue.putWriteBuffer(buffer, false, events);
- queue.put1DRangeKernel(addKernel, 0, elements, 1, writeEvent, kernelEvents);
- queue.put1DRangeKernel(mulKernel, 0, elements, 1, writeEvent, kernelEvents);
+ queue.put1DRangeKernel(addKernel, 0, elements, 1, events, events);
+ queue.put1DRangeKernel(mulKernel, 0, elements, 1, events, events);
- queue.putReadBuffer(buffer, false, kernelEvents, null);
+ queue.putReadBuffer(buffer, false, events, null);
queue.finish();
- writeEvent.release();
- kernelEvents.release();
+ events.release();
for (int i = 0; i < elements; i++) {
assertEquals(4, buffer.getBuffer().get(i));
@@ -372,7 +371,7 @@ public class CLCommandQueueTest {
final CountDownLatch countdown = new CountDownLatch(1);
customEvent.registerCallback(new CLEventListener() {
-
+ @Override
public void eventStateChanged(CLEvent event, int status) {
out.println("event received: "+event);
assertEquals(event, customEvent);