summaryrefslogtreecommitdiffstats
path: root/test/com/jogamp
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-06-20 22:35:03 +0200
committerMichael Bien <[email protected]>2011-06-20 22:35:03 +0200
commit16c4aaeb9002f9d79732648c1a15e9750c9de35c (patch)
treef88e9d3337be414c5feb39f1b291c4b469cf265c /test/com/jogamp
parenta256925d0f589e387bd6370a7b4c5ab7c8b0b01e (diff)
CLCommandQueuePool support for invokeAny(tasks).
Diffstat (limited to 'test/com/jogamp')
-rw-r--r--test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
index 81d34907..68ca33f9 100644
--- a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
+++ b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
@@ -78,6 +78,7 @@ public class CLMultiContextTest {
this.data = buffer;
}
+ @Override
public Buffer execute(CLSimpleQueueContext qc) {
CLCommandQueue queue = qc.getQueue();
@@ -134,27 +135,36 @@ public class CLMultiContextTest {
out.println("invoking "+tasks.size()+" tasks on "+pool.getSize()+" queues");
// blocking invoke
- pool.invokeAll(tasks);
+ List<Future<Buffer>> results = pool.invokeAll(tasks);
+ assertNotNull(results);
checkBuffer(1, data);
// submit blocking emediatly
for (CLTestTask task : tasks) {
- pool.submit(task).get();
+ Buffer ret = pool.submit(task).get();
+ assertNotNull(ret);
}
checkBuffer(2, data);
// submitAll using futures
List<Future<Buffer>> futures = pool.submitAll(tasks);
for (Future<Buffer> future : futures) {
- future.get();
+ Buffer ret = future.get();
+ assertNotNull(ret);
}
checkBuffer(3, data);
// switching contexts using different program
factory = CLQueueContextFactory.createSimple(programSource.replaceAll("\\+\\+", "--"));
pool.switchContext(factory);
- pool.invokeAll(tasks);
+ List<Future<Buffer>> results2 = pool.invokeAll(tasks);
+ assertNotNull(results2);
checkBuffer(2, data);
+
+ // submit any
+ Buffer buffer = pool.invokeAny(tasks);
+ assertNotNull(buffer);
+ checkContains(1, data);
pool.release();
}finally{
@@ -169,4 +179,14 @@ public class CLMultiContextTest {
data.rewind();
}
+ private void checkContains(int expected, IntBuffer data) {
+ while(data.hasRemaining()) {
+ if(expected == data.get()){
+ data.rewind();
+ return;
+ }
+ }
+ fail();
+ }
+
}