Last Updated: February 25, 2016
·
2.93K
· rjeschke

OpenCL kernel support header for Eclipse CDT

As there is a lack of free OpenCL kernel editing tools and I'm really into using Eclipse for Java and C/C++ I decided to write a C++ header which defines OpenCL types and methods.

Here's the way I'm using this header for kernel development:

I'm using my own Java OpenCL bindings (which will be published to Github soon) and therefore store my kernels as Java resources (maven-style). Now, for editing kernels:

  • I fire up Eclipse C++
  • Create a new, empty makefile, C++ project and use the kernel storage folder inside the Java project as base directory
  • I also have an ~/include folder which gets added to the include environment variables so I don't need to add any additional paths inside the project or copy the header around
  • For guarding the emulation header I use a simple #ifdef guard and a project specific define
#ifdef _DEVMODE
#   include "OpenCLKernel.hpp"
#endif

As OpenCL is C99 compliant (more or less) the above code won't interfere with later kernel compilation.

That's all to enjoy auto-completion, type-hints, static code-analysis, refactorings, outlines and all the other nice CDT features when editing OpenCL kernel files.

Here's the link to the header as a Github gist: https://gist.github.com/rjeschke/5701109

I think this gist will be moved into a separate project in the future and maybe also contain headers for 'half' data types, extensions and maybe also GLSL editing.