From a2cf85ca7c9e90cec6604559548e6b73a82d57da Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Wed, 16 Jun 2010 17:30:59 +0200 Subject: moved calls to program.createCLKernels() into seperate test method. NV CL 1.1 devdriver has some issues in this area. --- test/com/jogamp/opencl/CLProgramTest.java | 40 +++++++++++++++++++----- test/com/jogamp/opencl/HighLevelBindingTest.java | 10 +----- 2 files changed, 34 insertions(+), 16 deletions(-) (limited to 'test') 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 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 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 clBufferB = context.createBuffer(srcB, Mem.READ_ONLY); CLBuffer clBufferC = context.createBuffer(dest, Mem.WRITE_ONLY); - Map 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) -- cgit v1.2.3