summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-05-08 19:46:28 +0200
committerMichael Bien <[email protected]>2011-05-08 19:46:28 +0200
commitdedded707fc70fda3e40cf963d208202f8d6c42b (patch)
tree0a1937e9b0ece8196055ad274e665cc8d407c472 /test
parent19cc9195c73002f84c153a1ffc60f00408e1176e (diff)
added context switching functionality.
Diffstat (limited to 'test')
-rw-r--r--test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
index f076324a..7a1ed7aa 100644
--- a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
+++ b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
@@ -23,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() {
@@ -52,15 +52,11 @@ 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"
+ "kernel void vectorAdd(global const int* a, global const int* b, global int* c, int iNumElements) { \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";
@@ -75,6 +71,8 @@ public class CLMultiContextTest {
CLCommandQueuePool pool = CLCommandQueuePool.create(factory, mc);
assertTrue(pool.getSize() > 0);
+
+ pool.switchContext(factory);
pool.release();
}finally{