OpenCL support for C++ template

OpenCL support for C++ template


I'm trying to port an OpenCL kernel that contains C++ template declarations. The compilation of the kernel code (with clCreateProgramWithSource) fails because it does not recognise the "template" symbol.

Is there a way around this?

I'm using the latest Intel OpenCL SDK on a machine equipped with Xeon Phi, and the example codes run just fine.

Many thanks.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Aram,

Please note that there is a separate forum for Intel SDK for OpenCL Applications -

As for your question - I guess that this kernel was developed using AMD APP SDK which has some support for C++ template called "Bolt". This is not a standard OpenCL feature (currently at least), so I guess naive solution would be to get rid of template keyword and implement as many kernels (with as many data types) as you wish to support.


Hi Yuri and thank you for your response.

I missed the OpenCL section, apologies.

Your guess is accurate, the code was developed against AMD APP SDK. My hope was that the Intel OpenCL SDK had an extension for C++ template support similar to the AMDs. Your suggestion of getting rid of the template definitions is not practically feasible in my case because there are too many templates and the kernel code size is substantial. (perhaps only with some compiler aided approach it could be done).


Aram & Yuri,

I moved this thread to the OpenCL SDK forum. If you think this is inappropriate, please let me know.


Thank about that Taylor. If you can please delete this thread too 

Leave a Comment

Please sign in to add a comment. Not a member? Join today