diff options
author | Michael Bien <[email protected]> | 2010-04-12 22:27:03 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-04-12 22:27:03 +0200 |
commit | 2c85c416d85205ab98b33e1a0b0daab32d4d81ff (patch) | |
tree | 4187ba06dec81da46495a300bb4f914e931f0c58 /src/com/jogamp/opencl/demos/hellojocl/VectorAdd.cl | |
parent | b51f2e1c254cdd74c9e43904c62694f64e6ae7e6 (diff) |
changes due to package renaming in jocl.
Diffstat (limited to 'src/com/jogamp/opencl/demos/hellojocl/VectorAdd.cl')
-rw-r--r-- | src/com/jogamp/opencl/demos/hellojocl/VectorAdd.cl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/demos/hellojocl/VectorAdd.cl b/src/com/jogamp/opencl/demos/hellojocl/VectorAdd.cl new file mode 100644 index 0000000..ac9dde2 --- /dev/null +++ b/src/com/jogamp/opencl/demos/hellojocl/VectorAdd.cl @@ -0,0 +1,15 @@ + + // OpenCL Kernel Function for element by element vector addition + kernel void VectorAdd(global const float* a, global const float* b, global float* c, int numElements) { + + // 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 >= numElements) { + return; + } + + // add the vector elements + c[iGID] = a[iGID] + b[iGID]; + }
\ No newline at end of file |