I\'m a novice in OpenCL.
I have an algorithm which uses templates. It worked well with OpenMP parallelization but now the amount of data has grown and the only way t
You can have a look at VexCL which uses expression templates to generate OpenCL kernels. You can get some ideas on how to make OpenCL to work nicely with templates.
Another library that is being actively worked on is Boost.Compute which is a layer on top of OpenCL to allow generic C++ code.
The general idea is to create the kernel as a C string more or less and pass it down to the OpenCL runtime for compilation and execution.