summaryrefslogtreecommitdiffstats
path: root/test/com/mbien/opencl/testkernels.cl
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2009-10-20 22:06:10 +0200
committerMichael Bien <[email protected]>2009-10-20 22:06:10 +0200
commitabe0135b4457d4c4ff722b0f39a47cad6c178f7e (patch)
treecba794c54c5cc0f9d005b8ab2d7781f739c01d07 /test/com/mbien/opencl/testkernels.cl
parent7f2db980b303fa75f3830679ce65fe4ae41c30dc (diff)
refactored JOCLTest into LowLevelBindingTest and HighLevelBindingTest.
moved listCLPlatforms() and getLowLevelBinding() from CLContext to CLPlatform. added method to create CLPrograms from InputStreams and updated test.
Diffstat (limited to 'test/com/mbien/opencl/testkernels.cl')
-rw-r--r--test/com/mbien/opencl/testkernels.cl22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/com/mbien/opencl/testkernels.cl b/test/com/mbien/opencl/testkernels.cl
new file mode 100644
index 00000000..0790cb32
--- /dev/null
+++ b/test/com/mbien/opencl/testkernels.cl
@@ -0,0 +1,22 @@
+
+ // OpenCL Kernel Function for element by element vector addition
+ __kernel void VectorAddGM(__global const int* a, __global const int* b, __global int* c, int iNumElements) {
+ // get index into global data array
+ int iGID = get_global_id(0);
+ // bound check (equivalent to the limit on a 'for' loop for standard/serial C code
+ if (iGID >= iNumElements) {
+ return;
+ }
+ // add the vector elements
+ c[iGID] = a[iGID] + b[iGID];
+ }
+
+ __kernel void Test(__global const int* a, __global const int* b, __global int* c, int iNumElements) {
+ // get index into global data array
+ int iGID = get_global_id(0);
+ // bound check (equivalent to the limit on a 'for' loop for standard/serial C code
+ if (iGID >= iNumElements) {
+ return;
+ }
+ c[iGID] = iGID;
+ }