aboutsummaryrefslogtreecommitdiffstats
path: root/test/com/jogamp
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-05-07 02:11:44 +0200
committerMichael Bien <[email protected]>2011-05-07 02:11:44 +0200
commit19cc9195c73002f84c153a1ffc60f00408e1176e (patch)
tree2be66b79e071e1acddabf89eae3dd440435f26a4 /test/com/jogamp
parent8df524bf292051455005869ddfcfcc761af576e1 (diff)
introduced CLQueueContext and its factory - WIP.
Diffstat (limited to 'test/com/jogamp')
-rw-r--r--test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java35
1 files changed, 33 insertions, 2 deletions
diff --git a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
index 8e96dafa..f076324a 100644
--- a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
+++ b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
@@ -6,6 +6,7 @@ package com.jogamp.opencl.util.concurrent;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLDevice;
import com.jogamp.opencl.CLPlatform;
+import com.jogamp.opencl.util.concurrent.CLQueueContextFactory.CLSimpleContextFactory;
import org.junit.Rule;
import org.junit.rules.MethodRule;
import org.junit.rules.Timeout;
@@ -22,8 +23,8 @@ import static java.lang.System.*;
*/
public class CLMultiContextTest {
- @Rule
- public MethodRule methodTimeout= new Timeout(10000);
+// @Rule
+// public MethodRule methodTimeout= new Timeout(10000);
@Test
public void createMultiContextTest() {
@@ -50,5 +51,35 @@ public class CLMultiContextTest {
}
+ private final static String programSource =
+ " // OpenCL Kernel Function for element by element vector addition \n"
+ + "kernel void vectorAdd(global const int* a, global const int* b, global int* c, int iNumElements) { \n"
+ + " // get index in global data array \n"
+ + " int iGID = get_global_id(0); \n"
+ + " // bound check (equivalent to the limit on a 'for' loop for standard/serial C code \n"
+ + " if (iGID >= iNumElements) { \n"
+ + " return; \n"
+ + " } \n"
+ + " // add the vector elements \n"
+ + " c[iGID] = a[iGID] + b[iGID]; \n"
+ + "} \n";
+
+ @Test
+ public void commandQueuePoolTest() {
+
+ CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
+
+ try {
+
+ CLSimpleContextFactory factory = CLQueueContextFactory.createSimple(programSource);
+ CLCommandQueuePool pool = CLCommandQueuePool.create(factory, mc);
+
+ assertTrue(pool.getSize() > 0);
+
+ pool.release();
+ }finally{
+ mc.release();
+ }
+ }
}