I have been working on programming a convolutional back-propagation neural network recently and I have mainly been using Java to run the program and libGDX for the graphical visualizations. Through heavy research, I have found that to heavily increase performance and efficiency, I should preform the matrix calculations on the graphics card instead of on the CPU.
After looking through sources online, I found that the main way to preform such calculations on the graphics card was through OpenCl. After even more research, I discovered that my main two options for OpenCl support on Java was through LWJGL or JOCL.
libGDX was built on LWJGL, so my first instinct was to see if I could access that built in OpenCL support through the libGDX library, however, after looking around, I found nothing about this whatsoever!
My question is, can I access OpenCl through the libGDX library, and if so, how?
If I can't access LWJGL's OpenCl implementation, should I use JOCL to access GPU mathematical computations, or should I add a second library of LWJGL into my libGDX application?
Not sure if it's in Lwjgl2 in GDX, but I know the LibGDX Lwjgl3 implementation does not include it. But Lwjgl3 is broken up into modules, so you can add the OpenCL module in your Gradle project.
In "core"
dependencies, add
compile "org.lwjgl:lwjgl-opencl:3.1.0"
What I don't know is if this OpenCL module has any dependencies on the core of Lwjgl3. If so, you might want to switch to the LibGDX Lwjgl3 backend. To switch to Lwjgl3, in the "desktop"
dependencies, add 3
after lwjgl3
, so:
compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
If you switch to Lwjgl3, you have to clean up some of the DesktopLauncher imports and class names, basically adding 3 after Lwjgl in the class names (scroll down here for instructions if you need them).
You may have to keep the version number in sync with the version of Lwjgl3 the LibGDX version is using.