summaryrefslogtreecommitdiffstats
path: root/test/com/jogamp/opencl
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-06-16 17:30:59 +0200
committerMichael Bien <[email protected]>2010-06-16 17:30:59 +0200
commita2cf85ca7c9e90cec6604559548e6b73a82d57da (patch)
tree4ce95125f092a16ed2048bb87b9fb3ee917d83b0 /test/com/jogamp/opencl
parent3fa5e65225e074dc5bee626766e98e022d9dd1d2 (diff)
moved calls to program.createCLKernels() into seperate test method.
NV CL 1.1 devdriver has some issues in this area.
Diffstat (limited to 'test/com/jogamp/opencl')
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java40
-rw-r--r--test/com/jogamp/opencl/HighLevelBindingTest.java10
2 files changed, 34 insertions, 16 deletions
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index fd98e78e..392bf33f 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -61,9 +61,8 @@ public class CLProgramTest {
assertTrue(program.isExecutable());
- Map<String, CLKernel> kernels = program.createCLKernels();
- assertNotNull(kernels);
- assertTrue("kernel map is empty", kernels.size() > 0);
+ CLKernel kernel = program.createCLKernel("VectorAddGM");
+ assertNotNull(kernel);
// rebuild
// 1. release kernels (internally)
@@ -73,10 +72,8 @@ public class CLProgramTest {
out.println(program.getBuildStatus());
// try again with rebuilt program
- kernels = program.createCLKernels();
- assertNotNull(kernels);
- assertTrue("kernel map is empty", kernels.size() > 0);
- assertTrue(kernels.size() > 0);
+ kernel = program.createCLKernel("VectorAddGM");
+ assertNotNull(kernel);
context.release();
}
@@ -277,6 +274,35 @@ public class CLProgramTest {
}
+ @Test
+ public void createAllKernelsTest() {
+
+ String source = "kernel void foo(int a) { }\n"+
+ "kernel void bar(float b) { }\n";
+
+ CLContext context = CLContext.create();
+ try{
+ CLProgram program = context.createProgram(source).build();
+ assertTrue(program.isExecutable());
+
+ Map<String, CLKernel> kernels = program.createCLKernels();
+ for (CLKernel kernel : kernels.values()) {
+ out.println("kernel: "+kernel.toString());
+ }
+
+ assertNotNull(kernels.get("foo"));
+ assertNotNull(kernels.get("bar"));
+
+ kernels.get("foo").setArg(0, 42);
+ kernels.get("bar").setArg(0, 3.14f);
+
+
+ }finally{
+ context.release();
+ }
+
+ }
+
// @Test
public void loadTest() throws IOException, ClassNotFoundException, InterruptedException {
for(int i = 0; i < 100; i++) {
diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java
index 35c13261..e08fadc7 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -279,15 +279,7 @@ public class HighLevelBindingTest {
CLBuffer<ByteBuffer> clBufferB = context.createBuffer(srcB, Mem.READ_ONLY);
CLBuffer<ByteBuffer> clBufferC = context.createBuffer(dest, Mem.WRITE_ONLY);
- Map<String, CLKernel> kernels = program.createCLKernels();
- for (CLKernel kernel : kernels.values()) {
- out.println("kernel: "+kernel.toString());
- }
-
- assertNotNull(kernels.get("VectorAddGM"));
- assertNotNull(kernels.get("Test"));
-
- CLKernel vectorAddKernel = kernels.get("VectorAddGM");
+ CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM");
vectorAddKernel.setArg(0, clBufferA)
.setArg(1, clBufferB)