cf4ocl (C Framework for OpenCL)  v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
canon.cl
/*
* This file is part of cf4ocl (C Framework for OpenCL).
*
* cf4ocl is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* cf4ocl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with cf4ocl. If not, see <http://www.gnu.org/licenses/>.
* */
/*
* This is the OpenCL kernel for the canonical example canon.c.
*/
__kernel void sum(__global const uint *a, __global const uint *b,
__global uint *c, uint d, uint buf_size) {
/* Get global ID. */
uint gid = get_global_id(0);
/* Only perform sum if this workitem is within the size of the
* vector. */
if (gid < buf_size)
c[gid] = a[gid] + b[gid] + d;
}