OpenCL C to OpenCL C++ Porting Guidelines

On May 16, OpenCL 2.2 was released by Khronos Group. The most important part of the new OpenCL version is support for OpenCL C++ kernel language, which is defined as a static subset of the C++14 standard.  OpenCL C++ introduces long-awaited features such as classes, templates, lambda expressions, function and operator overloads, and several other constructs which increase parallel programming productivity through generic programming.

The question is how to quickly make use of it. Unfortunately most examples in the various SDKs are written in C, and are not yet translated to C++. To simplify the process, Jakub Szuppe of Stream HPC created a document with porting guidelines for developers who know OpenCL C but need to know the main differences between those two kernel languages.

The main focus is on exposing the most important differences between OpenCL C++ and OpenCL C, and also those which may cause hard-to-detect bugs when porting to OpenCL C++. Developers who are familiar with both OpenCL C and C++ should find OpenCL C++ easy to learn.

You can find the guidelines here, hosted on Github. We welcome feedback from the community - simply file a new issue with any comments.

Authored by



Khronos® and Vulkan® are registered trademarks, and ANARI™, WebGL™, glTF™, NNEF™, OpenVX™, SPIR™, SPIR-V™, SYCL™, OpenVG™ and 3D Commerce™ are trademarks of The Khronos Group Inc. OpenXR™ is a trademark owned by The Khronos Group Inc. and is registered as a trademark in China, the European Union, Japan and the United Kingdom. OpenCL™ is a trademark of Apple Inc. and OpenGL® is a registered trademark and the OpenGL ES™ and OpenGL SC™ logos are trademarks of Hewlett Packard Enterprise used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners.