I’ve read about OpenCL lately and there is a library in Java that will allow the use of OpenCL. At to what extent that OpenCL and be used with Java. Also, is there any way that JVM can automatically offload process in the GPU transparently in the Java code.
One application would be with Java-to-Javascript compilers which can’t use OpenCL directly, but its VM that do the translation can use the parallel processing perhaps?
The short answer is no. Since the JVM is not built to recognize parallelism.
The longer answer is that you can do it with relatively few effort. At http://www.jocl.org you can find a JAR file which enables OpenCL support in Java, as well as some tutorials how to do this. If you have a fairly simple loop body in your Java code that is your bottleneck, there’s a good chance OpenCL would give a nice improvement. I’ve often found an improvement x10 or larger, but this depends on your GPU. Differences over x100 have been reported.
It is not “integrated” in java though, you write the loop body in a .cl file and execute it from your main Java files. On the bright side, some IDEs (such as Netbeans) have OpenCL editor plugins on the web, which makes everything look more integrated. 🙂