TornadoVM Makes It Possible To Run Java on GPUs and FPGAs
Written by Nikos Vaggalis   
Thursday, 21 April 2022

A ray tracer in Java? That's just absurd! Is Java stepping into C++ privileged territory? Yes it is, thanks to TornadoVM.

TornadoVM is a plugin to OpenJDΚ which allows you to run Java on GPU's, FPGAs and dedicated hardware in order to achieve massive gains in performance. For example, the Java Ray Tracer project based on TornadoVM achieves acceleration from 1 FPS in Java to 60 FPS running on Intel HD Graphics and NVIDIA GPUs.

Performance aside, TornadoVM makes programming on such hardware possible with Java and other JVM-based languages, as such breaching the status quo of C++, OpenCL or Cuda. Last time we examined a similar approach was with Python in "Program Deep Learning on the GPU with Triton":

NVIDIA's CUDA toolkit provides a development environment for speeding up computing applications by harnessing the power of GPUs, but it requires the code to be written code in C++. As C++ by default is not user-friendly and difficult to master,these properties subsequently rub off on the toolkit itself.

Wouldn't it be easier to use a language that is user-friendly to write your GPU-accelerated deep learning applications in?

That is what TornadoVM aims to do by exposing an API and annotations with which you mark your methods:

You mark your method with @Parallel add the parallel annotation as a hint for the compiler, initiate a TaskSchedule and call its task method. The other methods that TaskSchedule exposes are streamIn(),streamOut() and execute().

Under the covers TornadoVM uses GraalVM and specifically a version of its Graal JIT to translate the bytecode to OpenCL or Nvidia PTX. For more on GraalVM's internals check GraalVM under the covers.

The use cases are plenty. One I have already mentioned in building a real-time ray tracer in Java accelerated on heterogeneous hardware. Another is the open-source implementation of Kinect Fusion algorithm directly run on GPUs.

Yet another algorithm implementation is that of ViolaJones, an established algorithm for face or general feature detection. There are existing Java implementations such as jviolajones, but these tend to be slower than implementations which layer on top of JNI and OpenCV.

Of course, it has applications in Natural Language Processing (NLP) and in Healthcare, where TornadoVM has been utilized to accelerate the training process of the ML-based predictive model, which takes into account over 50 features (e.g. patient number, gender, age, admission type, etc.).

The latest version, 0.13, supports JDK 17 and GraalVM 21.3, deprecating OpenJDK 8 and making OpenJDK 11 the default.

It can be installed manually on a variety of platforms and is also available as Docker images.The project is open source and hosted on Github.

 

More Information

TornadoVM

Related Articles

GraalVM under the covers

Program Deep Learning on the GPU with Triton

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Copilot Improves Code Quality
27/11/2024

Findings from GitHub show that code authored with Copilot has increased functionality and improved readability, is of better quality, and receives higher approval rates than code authored without it.

 [ ... ]



Hour Of Code 2024 Is About To Kick Off
04/12/2024

This year the event that aims to provide a coding experience for all school students and anyone else who wants to join in runs between December 9th and 15th and includes new activities. Let's find out [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Thursday, 21 April 2022 )