diff options
Diffstat (limited to 'test/com/mbien/opencl/testkernels.cl')
-rw-r--r-- | test/com/mbien/opencl/testkernels.cl | 22 |
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; + } |