aboutsummaryrefslogtreecommitdiffstats
path: root/test/com
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-04-15 21:36:21 +0200
committerMichael Bien <[email protected]>2010-04-15 21:36:21 +0200
commitbb14f43134a9332c014e969b600e094edadd2fb0 (patch)
treea63678de5a0b8b5f5c21bd732b159ba151c274f9 /test/com
parent966153e376f9932cea29d8bd891a164115a4049c (diff)
code review: improved exception messages to be more verbose whenever possible.
began with CLKernel testcase.
Diffstat (limited to 'test/com')
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java7
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java28
2 files changed, 35 insertions, 0 deletions
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index a5d7afb..e2da566 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -72,6 +72,8 @@ public class CLCommandQueueTest {
CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM").setArg(3, elements);
CLCommandQueue queue = context.getDevices()[0].createCommandQueue();
+ out.println(queue);
+
final CLEventList events = new CLEventList(2);
assertEquals(0, events.size());
@@ -129,6 +131,8 @@ public class CLCommandQueueTest {
CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM").setArg(3, elements);
CLCommandQueue queue = context.getDevices()[0].createCommandQueue(Mode.PROFILING_MODE);
+ out.println(queue);
+
queue.putWriteBuffer(clBufferA, true) // write A
.putWriteBuffer(clBufferB, true);// write B
@@ -192,6 +196,9 @@ public class CLCommandQueueTest {
final CLCommandQueue queue1 = devices[0 ].createCommandQueue();
final CLCommandQueue queue2 = devices[secondDevice].createCommandQueue();
+ out.println(queue1);
+ out.println(queue2);
+
fillBuffer(clBufferC.buffer, 12345);
if (secondDevice > 0) {
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index 8b5d436..18ae1e8 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -153,6 +153,8 @@ public class CLProgramTest {
assertTrue(program.isExecutable());
+ context.release();
+
}
@Test
@@ -217,8 +219,34 @@ public class CLProgramTest {
// cloneing
assertEquals(builder, builder.clone());
+ context.release();
}
+ @Test
+ public void kernelTest() {
+
+ String source = "__attribute__((reqd_work_group_size(512, 512, 512))) kernel void foo(void) { }\n";
+
+ CLContext context = CLContext.create();
+
+ try{
+ CLProgram program = context.createProgram(source).build();
+ assertTrue(program.isExecutable());
+
+ CLKernel kernel = program.createCLKernel("foo");
+ assertNotNull(kernel);
+
+ long[] wgs = kernel.getCompileWorkGroupSize(context.getDevices()[0]);
+
+ // TODO test on other hardware and compare results
+ out.println("compile workgroup size: " + wgs[0]+" "+wgs[1]+" "+wgs[2]);
+
+ }finally{
+ context.release();
+ }
+
+ }
+
}