Today, specialized programming frameworks like OpenCL, CUDA or DirectCompute, are the most commonly used methods of tapping into GPUs for general-purpose computing. With all of these, the parallelization of the code as well as the processor-specific manipulations that move the algorithms and data from the CPU to the GPU have to be performed manually. This presents something of a challenge to the average programmer.
Fortunately there are a number of efforts underway to make GPU programming a more high-level affair. One of them was described today in UK’s bit-tech, which reported that a team from Syracuse University has developed a Java compiler aimed at GPU computing. Phil Pratt-Szeliga, an instructor at Syracuse University along, with partners Jim Fawcett and Roy Welch, worked together on the project, known as Rootbeer. In a paper that describes the technology, they claim that Rootbeer is “the most full-featured tool to enable GPU computing from within Java to date.”
The goal was to develop a compiler that could that would allow programmers to use standard Java for GPU computing, without having to know the intricacies of parallel programming or processor hardware. These are not just bindings to CUDA and OpenCL libraries. Rootbeer is able to take unmodified Java source and then, under the covers, automatically parallelize the code and launch the GPU kernel.
Rootbeer supports all standard Java features except dynamic method invocation, reflection and native methods. The features that are supported for the GPU include single and multi-dimensional arrays (primitive and reference types), composite objects, instance and static fields, dynamic memory allocation, inner classes, synchronized methods and monitors, strings, and exceptions that are thrown or caught on the GPU.
The compiler is currently targeted to NVIDIA processors since the hardware offers programmer-friendly support, such as the ability to execute recursive functions. Internally the Java Bytecode is converted to CUDA.
The compiler developers have also developed three applications to demonstrate the compiler’s capabilities. As you can see, execution speedups are not guaranteed:
- Dense Matrix Multiplication: 67 times faster
- Brute Force Fourier Transform: 54 times faster
- Sobel Filter: 3.8 times slower (oops)
Pratt-Szeliga says he plans to maintain the compiler indefinitely and is willing to fix any and all bugs sent to him. Rootbeer is available for free as open source software licensed under the GNU General Public License.