My first experiment with OpenCL was in XCode on Mac and I was wondering if there is also support for Java. My C/C++ skills are not what they used to be and I feel more comfortable with Java. Luckily there is a binding for Java which is called Javacl and I have tried to make the shortest working example to learn how OpenCL is working and how the library must be used. I’m sharing this example because I found that there are not many simple short examples.
At the end of the post you find the complete sourcecode I’ve used and I will describe the code in a few blocks to make clear what it does and why. You should be familiar with some of the OpenCL terminology, this helps in understanding the code.