concept example code in category opencl

This is an excerpt from Manning's book OpenCL in Action: How to Accelerate Graphics and Computation.
If you open the directory containing this book’s example code, you’ll find the source files in the Ch1 folder. The first, matvec.c, executes on the host. It creates a kernel and sends it to the first device it finds. The following listing shows what this host code looks like. Notice that the source code is written in the C programming language.
The bitonic sort is one of the more complicated sorting algorithms, but it lends itself very well to parallel computation. The algorithm consists of two steps: transforming the input data into a bitonic sequence, and sorting the bitonic sequence. Both tasks require essentially the same compare-and-swap operations, and for this reason the bitonic sort is usually performed recursively. But the example code in this chapter presents a method of executing the sort in an iterative, parallel manner.