From 19cc9195c73002f84c153a1ffc60f00408e1176e Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 7 May 2011 02:11:44 +0200 Subject: introduced CLQueueContext and its factory - WIP. --- .../opencl/util/concurrent/CLMultiContextTest.java | 35 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'test/com') 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(); + } + } } -- cgit v1.2.3