Is it possible to bind some matrix/FFT GPU-accelerated library to JOCL


I was playing with the sample codes of JOCL and I also wrote some by myself and ported some from other tutorials to JOCL (like NBody problem).

However I think for very common mathemtical/numerical taks it would be better to use some well optimized code developed by some experts than try to write it by myself.

So I wonder if there is some possibility to use some 3rd party OpenCL libraris in JOCL for taks like
matrix operation ( multiplication, LU decomposition, inversion, solution of system of linear equation, eigenvalue ) and FFT.

for example libraries like this:

The problem is that these libraries are in C, and I don’t want to do development in C just because of that. I’m currently working with jMonkey and LWJGL and I like it very much including the JOCL support. However, some well optimized prefabricated GPU accelerated mathematical library would be very welcome. a



Of course, I know that there is a demand for that. Writing a simple matrix multiplication in OpenCL may be nearly trivial. Writing a fast matrix multiplication in OpenCL may be challenging. But writing optimized (and verified) implementations of all BLAS 1,2 and 3 kernels is certainly something that should be left to experts.

The AMD library is closed-source and ships as a standard C library. The only possiblity to call it from Java would be via JNI (or JNA or BridJ - I can only guess why no one is trying to do this…). Once I started creating bindings for the AMD BLAS and FFT libraries, but I simply don’t have the time to properly maintain more of these libraries - although it would be nice to have such a library, since it could smoothly interoperate with JOCL.

Apart from that, there are open source libraries like MAGMA ( ) or ViennaCL ( ) and maybe others. They have different goals and focusses and use different … well… “strategies” to generate and call the OpenCL backends. These “strategies” are related to things like calling other C-libraries or using excessive C++ template magic. No plain OpenCL there.

So after all, I’m not aware of the existence of what we (and many other people) would like to have: A plain set of .CL files with BLAS kernels which can just be loaded and called. It’s a pity.