Sunday, February 19, 2012

OpenCL Compilation Tool

I wrote a simple OpenCL compiler interface tool, partially to sink my teeth into OpenCL, partially because I wanted it. Also it seems I'm one of the few who's tackling OpenCL from a pure C angle, so this code may be useful to other folks going down that path.

It should be noted, that there is already a tool that does this, clcc, which supports... well... options. All of them it seems. It's written in C++, uses Boost, etc. I encourage folks to use that one instead of mine, it's much better. But if you're a fan of KISS, then you might want to check out mine. But clcc is better. On with the show...

Invoking it displays it's usage...

OpenCL Compiler Test Tool
(c) 2012 Daniel Burke -
                display arguments and devices
        ocl filename
                compile filename with first device
        ocl N filename
                compile filename with Nth device

The Device list is...
AMD Accelerated Parallel Processing
   0    ATI RV770
   1    ATI RV770
   2    Intel(R) Core(TM)2 Duo CPU     E8600  @ 3.33GHz
Intel(R) OpenCL
   3    Intel(R) Core(TM)2 Duo CPU     E8600  @ 3.33GHz

If compilation works, it tells you how many bytes the binary is. If it fails, it outputs the compiler messages. That's it. It's a single C file, the linked archive includes a Makefile for Mingw, and a binary for windows. It's so simple you should have *no* problems building it on anything. Compiles with gcc and clang with -Wall with no warnings. What more could you want? Features? Use clcc.

No comments:

Post a Comment