Basic Concepts: online kernel compiling

Typos are a programmers worst nightmare, as they are bad for concentration. The code in your head is not the same as the code on the screen and therefore doesn’t have much to do with the actual problem solving. Code highlighting in the IDE helps, but better is to use the actual OpenCL compiler without running your whole software: an Online OpenCL Compiler. In short is just an OpenCL-program with a variable kernel as input, and thus uses the compilers of Intel, AMD, NVidia or whatever you have installed to try to compile the source. I have found two solutions, which both have to be built from source – so a C-compiler is needed.

  • CLCC. It needs the boost-libraries, cmake and make to build. Works on Windows, OSX and Linux (needs possibly some fixes, see below).
  • OnlineCLC. Needs waf to build. Seems to be Linux-only.

For both you can just give the source-file of the kernel, optionally which driver/device to use. With OnlineCLC it is not very clear what is meant with the “device” option and I am trying to find that out and hope to update this article soon. CLCC has an extra option to specify the device-type (GPU, CPU, etc) to use. It is for instance possible to have these commands as an external command in your IDE, so you can check your kernel when needed. And don’t forget to write your test-cases with this – assuming the test-machine has all the devices.

Watch out! It is using the hardware for compiling too, so it can crash your machine as hard as you can do with your own GPGPU-software.

Getting CLCC working on Linux

The downloaded version 0.1 of CLCC does not work out-of-the-box on a recent Linux-distribution with the latest boost-libraries. You can check out of SVN, wait for the upcoming version 0.2 or enter the below fixes.

The file src/CMakeLists.txt needs “cmake_minimum_required(VERSION 2.8)” at the top and

if (UNIX)
target_link_libraries(clcc ${CMAKE_DL_LIBS})

to make the linking working. In options.cpp replace “ifdef __LINUX__” with “ifdef __linux__“. In main.cpp en clpp.cpp replace “#include <boost/exception.hpp>” with “#include <boost/exception/all.hpp>“. That’s all.

Now run

cmake -G "Unix Makefiles" .

in the root of the project. Now you are ready to run CLCC. Any feedback can go to george at organicvectory dot com.

Related Posts


Improving FinanceBench

...  for now: Get it started + low-hanging fruit in the kernels (WIP)Looking for structural problems outside the kernels + ...

Kabul - An Afghan National Police (ANP) students study basic logistics training at the Afghan Ministry in Interior (MOI) August 1, 2010. The Afghan MOI is providing the first ever computer based logistics training for ANP personnel. (U.S. Air Force photo/ Staff Sergeant Matt Davis)

OpenCL and CUDA programming training in Amsterdam

...  this is the training you should attend. The concepts can be applied to other GPU-languages too, which makes it a ...


Join us at the Dutch eScience Symposium 2019 in Amsterdam

Soon there will be another Dutch eScience Symposium 2019 in Amsterdam. We thought it might be a good place to meet and listen to e-science talks. Stre ...


We accelerated the OpenCL backend of pyPaSWAS sequence aligner

Last year we accelerated the OpenCL-code in PaSWAS, which is open source software to do DNA/RNA/protein sequence alignment and trimming. It has users  ...