AMD optimizes Java execution with Aparapi

AMD recently introduced Aparapi – A PARallel API – that allows Java workloads to be optionally executed on a GPU.

“Whether the workload is [run] on a GPU will depend on the specific platform (if OpenCL is available) and on the nature of the code, [as] some Java capabilities cannot be offloaded,” AMD’s Margaret Lewis explained in a blog post.

“If the workload cannot be executed on the GPU, the code will execute using a traditional Java thread pool on the CPU.”

According to Lewis, the primary advantage of Aparapi over existing OpenCL bindings is that devs write their code once in Java.

“And at runtime, Aparapi decides whether the code can be executed on the GPU or not.

“[So], the inherent goal of Java’s ‘write once, run anywhere’ programming model is [effectively] extended beyond crossing over multiple operating systems – to crossing multiple processing units.”

Lewis also noted that the alpha release of Aparapi has allowed AMD to  showcase the potential of using GPUs (and APUs) to optimize the performance of numerically intense data parallel compute workloads. 

“[For example], while OpenCL C provides an excellent environment for creating code that can execute on both the CPU and GPU, it takes the Java developer outside of his familiar world.

“[In contrast], Aparapi, an API [designed specifically] for expressing data parallel workloads in Java, [does not].”