diff options
author | Michael Bien <[email protected]> | 2009-11-08 21:48:29 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-11-08 21:48:29 +0100 |
commit | d2050aea14e6ab1a6429eab56f0612c2deb6184f (patch) | |
tree | ecb5b0fa28e3cc592b053cef7ac1dab3edcb684d /test/com/mbien | |
parent | c33ac63fb62d3d27979ca56bb577c18f745f70d4 (diff) |
improved Exception handling in CLProgram and CLKernel.
introduced CLResource interface for releasable resources.
CLProgram is now rebuildable.
Diffstat (limited to 'test/com/mbien')
-rw-r--r-- | test/com/mbien/opencl/HighLevelBindingTest.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/com/mbien/opencl/HighLevelBindingTest.java b/test/com/mbien/opencl/HighLevelBindingTest.java index edeedc6b..2a8807ad 100644 --- a/test/com/mbien/opencl/HighLevelBindingTest.java +++ b/test/com/mbien/opencl/HighLevelBindingTest.java @@ -225,5 +225,45 @@ public class HighLevelBindingTest { out.println("results are valid"); } + + @Test + public void rebuildProgramTest() throws IOException { + + out.println(" - - - highLevelTest; rebuild program test - - - "); + + CLContext context = CLContext.create(); + CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")); + + try{ + program.getCLKernels(); + fail("expected exception but got none :("); + }catch(CLException ex) { + out.println("got expected exception:\n"+ex.getMessage()); + assertTrue(ex.errorcode == CL.CL_INVALID_PROGRAM_EXECUTABLE); + } + + program.build(); + assertTrue(program.isExecutable()); + out.println(program.getBuildStatus()); + + Map<String, CLKernel> kernels = program.getCLKernels(); + assertNotNull(kernels); + assertTrue("kernel map is empty", kernels.size() > 0); + + // rebuild + // 1. release kernels (internally) + // 2. build program + program.build(); + assertTrue(program.isExecutable()); + out.println(program.getBuildStatus()); + + // try again with rebuilt program + kernels = program.getCLKernels(); + assertNotNull(kernels); + assertTrue("kernel map is empty", kernels.size() > 0); + assertTrue(kernels.size() > 0); + + context.release(); + } } |