aboutsummaryrefslogtreecommitdiffstats
path: root/test/com/jogamp
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-05-02 22:55:02 +0200
committerMichael Bien <[email protected]>2010-05-02 22:55:02 +0200
commit3b3dc4591d3690f61b9488ed74e7c9248def1fd5 (patch)
treec7c30c0a51d9a1dc22e9c52bb239b1ea96df3b07 /test/com/jogamp
parent59148a192446ddfefb13516d7ada72e6fa1661c7 (diff)
CLBuildListener functionality for high level bindings.
- uses low level BuildProgramCallback internally - updated tests, testing async builds
Diffstat (limited to 'test/com/jogamp')
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java11
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java23
-rw-r--r--test/com/jogamp/opencl/LowLevelBindingTest.java1
3 files changed, 25 insertions, 10 deletions
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index e2da5665..9070b268 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -172,6 +172,7 @@ public class CLCommandQueueTest {
CLDevice[] devices = context.getDevices();
+ // ignore this test if we can't test in parallel
if (devices.length < 2) {
out.println("aborting test... need at least 2 devices");
context.release();
@@ -188,22 +189,18 @@ public class CLCommandQueueTest {
CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
+ //two independent kernel instances
final CLKernel vectorAddKernel1 = program.createCLKernel("VectorAddGM").setArg(3, elements);
final CLKernel vectorAddKernel2 = program.createCLKernel("VectorAddGM").setArg(3, elements);
- int secondDevice = devices.length > 1 ? 1 : 0;
-
- final CLCommandQueue queue1 = devices[0 ].createCommandQueue();
- final CLCommandQueue queue2 = devices[secondDevice].createCommandQueue();
+ final CLCommandQueue queue1 = devices[0].createCommandQueue();
+ final CLCommandQueue queue2 = devices[1].createCommandQueue();
out.println(queue1);
out.println(queue2);
fillBuffer(clBufferC.buffer, 12345);
- if (secondDevice > 0) {
- System.out.println("using two devices");
- }
final MultiQueueBarrier barrier = new MultiQueueBarrier(2);
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index 35dbde4b..ec238fb5 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -3,6 +3,7 @@ package com.jogamp.opencl;
import com.jogamp.opencl.util.CLBuildConfiguration;
import com.jogamp.opencl.util.CLProgramConfiguration;
import com.jogamp.opencl.CLProgram.Status;
+import com.jogamp.opencl.util.CLBuildListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -10,6 +11,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Map;
+import java.util.concurrent.CountDownLatch;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -158,7 +160,7 @@ public class CLProgramTest {
}
@Test
- public void builderTest() throws IOException, ClassNotFoundException {
+ public void builderTest() throws IOException, ClassNotFoundException, InterruptedException {
out.println(" - - - CLProgramTest; program builder test - - - ");
CLContext context = CLContext.create();
@@ -187,8 +189,23 @@ public class CLProgramTest {
.withDefine("ENABLE_FOOBAR");
out.println(builder);
-
- builder.setProgram(program).build();
+
+ // async build test
+ {
+ final CountDownLatch countdown = new CountDownLatch(1);
+ final CLProgram outerProgram = program;
+
+ CLBuildListener buildCallback = new CLBuildListener() {
+ public void buildFinished(CLProgram program) {
+ assertEquals(outerProgram, program);
+ countdown.countDown();
+ }
+ };
+
+ builder.setProgram(program).build(buildCallback);
+ countdown.await();
+ }
+
assertTrue(program.isExecutable());
// serialization test
diff --git a/test/com/jogamp/opencl/LowLevelBindingTest.java b/test/com/jogamp/opencl/LowLevelBindingTest.java
index eb1d7bd4..2d6ea08f 100644
--- a/test/com/jogamp/opencl/LowLevelBindingTest.java
+++ b/test/com/jogamp/opencl/LowLevelBindingTest.java
@@ -1,5 +1,6 @@
package com.jogamp.opencl;
+import com.jogamp.opencl.impl.BuildProgramCallback;
import com.jogamp.common.nio.Int64Buffer;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.impl.CLImpl;