summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-01-22 19:49:02 +0100
committerMichael Bien <[email protected]>2010-01-22 19:49:02 +0100
commitceedf2ac1b1300a12a7b69a31b53787035fe7c13 (patch)
tree8e3bbc8e5a983479a2a99303eb9bca1a4306a28a
parent9ca000faa6aea6771ff5cf209846ef7fb9ff227a (diff)
added blockingWait parameter to putWaitForEvent(...) CLCommandQueue methods.
-rw-r--r--src/com/mbien/opencl/CLCommandQueue.java10
-rw-r--r--src/com/mbien/opencl/CLDevice.java2
-rw-r--r--src/com/mbien/opencl/QueueBarrier.java2
-rw-r--r--test/com/mbien/opencl/CLConcurrencyTest.java6
4 files changed, 11 insertions, 9 deletions
diff --git a/src/com/mbien/opencl/CLCommandQueue.java b/src/com/mbien/opencl/CLCommandQueue.java
index bc50210e..9825b871 100644
--- a/src/com/mbien/opencl/CLCommandQueue.java
+++ b/src/com/mbien/opencl/CLCommandQueue.java
@@ -179,18 +179,20 @@ public class CLCommandQueue implements CLResource {
return this;
}
- public CLCommandQueue putWaitForEvent(CLEventList list, int index) {
+ public CLCommandQueue putWaitForEvent(CLEventList list, int index, boolean blockingWait) {
int marker = list.IDs.position()-1;
list.IDs.position(index);
- int ret = cl.clWaitForEvents(1, list.IDs);
+ int ret = blockingWait ? cl.clWaitForEvents(1, list.IDs)
+ : cl.clEnqueueWaitForEvents(ID, 1, list.IDs);
list.IDs.position(marker);
checkForError(ret, "error while waiting for events");
return this;
}
- public CLCommandQueue putWaitForEvents(CLEventList list) {
+ public CLCommandQueue putWaitForEvents(CLEventList list, boolean blockingWait) {
list.IDs.rewind();
- int ret = cl.clWaitForEvents(list.size, list.IDs);
+ int ret = blockingWait ? cl.clWaitForEvents(list.size, list.IDs)
+ : cl.clEnqueueWaitForEvents(ID, list.size, list.IDs);
checkForError(ret, "error while waiting for events");
return this;
}
diff --git a/src/com/mbien/opencl/CLDevice.java b/src/com/mbien/opencl/CLDevice.java
index 44fbabfb..c948024b 100644
--- a/src/com/mbien/opencl/CLDevice.java
+++ b/src/com/mbien/opencl/CLDevice.java
@@ -331,7 +331,7 @@ public final class CLDevice {
/**
* Returns the optional double precision floating-point capability of the device.
* The mandated minimum double precision floating-point capabilities are {@link FPConfig#FMA},
- * {@link FPConfig#ROUND_TO_NEAREST}, {@link FPConfig#_ROUND_TO_ZERO},
+ * {@link FPConfig#ROUND_TO_NEAREST}, {@link FPConfig#ROUND_TO_ZERO},
* {@link FPConfig#ROUND_TO_INF}, {@link FPConfig#INF_NAN}, and {@link FPConfig#DENORM}.
* @return An EnumSet containing the extensions, never null.
*/
diff --git a/src/com/mbien/opencl/QueueBarrier.java b/src/com/mbien/opencl/QueueBarrier.java
index 73339192..37c5d3f1 100644
--- a/src/com/mbien/opencl/QueueBarrier.java
+++ b/src/com/mbien/opencl/QueueBarrier.java
@@ -51,7 +51,7 @@ public class QueueBarrier {
public QueueBarrier waitFor(CLCommandQueue queue, CLEventList events) {
checkQueue(queue);
- queue.putWaitForEvents(events);
+ queue.putWaitForEvents(events, true);
latch.countDown();
return this;
}
diff --git a/test/com/mbien/opencl/CLConcurrencyTest.java b/test/com/mbien/opencl/CLConcurrencyTest.java
index bcd290ad..bfa42907 100644
--- a/test/com/mbien/opencl/CLConcurrencyTest.java
+++ b/test/com/mbien/opencl/CLConcurrencyTest.java
@@ -48,7 +48,7 @@ public class CLConcurrencyTest {
.putWriteBuffer(clBufferB, false, events); // write B
assertEquals(2, events.size());
- queue.putWaitForEvents(events);
+ queue.putWaitForEvents(events, true);
events.release();
assertEquals(0, events.size());
@@ -60,8 +60,8 @@ public class CLConcurrencyTest {
queue.put1DRangeKernel(vectorAddKernel, 0, elements, 256, events);
assertEquals(2, events.size());
- queue.putWaitForEvent(events, 0)
- .putWaitForEvent(events, 1);
+ queue.putWaitForEvent(events, 0, false)
+ .putWaitForEvent(events, 1, true);
queue.putReadBuffer(clBufferC, false)
.putReadBuffer(clBufferD, true);