8

Is it possible to use Xeon Phi using JVM-based language such as Scala? Is there any example?

Boppity Bop
  • 9,613
  • 13
  • 72
  • 151
Kokizzu
  • 24,974
  • 37
  • 137
  • 233

3 Answers3

5

According to their FAQ there is not yet support for Java:

http://software.intel.com/en-us/articles/intelr-xeon-phitm-coprocessor-february-developer-webinar-qa-responses

Q: Is there a Java option for coding? A: Not yet.

user561749
  • 1,029
  • 9
  • 6
  • 1
    Further (Oct 23 2013): Q: Will the Xeon Phi support Java? The FAQ on Intel's site says "Not yet." Is there a timeline for this? A: No timeline yet. http://software.intel.com/en-us/articles/intel-xeon-phi-coprocessor-september-2013-developer-webinar-qa-responses I sure hope they will make it good. Scala (Akka) provides the abstraction to program such hardware. – akauppi Jan 25 '14 at 21:16
5

It is not officially supported, however, you can still build JVM on your own.

I have built JamVM with GNU Classpath and slightly modified version of libffi. You can also try with zero-assembler version of HotSpot. As a result, you can get extremely slow virtual machine - even using 60 threads it was more than 10 times slower than my quad core mobile i7 CPU. On the other hand, it is a great opportunity to test scalability of Java implementations that run on tens of threads simultaneously.

Another idea is to use Aparapi tool - parts of Java bytecode are translated into OpenCL and executed on Phi.

Artur Malinowski
  • 1,124
  • 10
  • 30
  • How might I use JamVM on the Intel Xeon Phi Coprocessor? Is there any way I can run it on the Xeon phi without needing to use Intel's compiler? And how can I utilize the mutliple threads the Xeon Phi supports? – KrystosTheOverlord Jun 07 '20 at 13:25
  • Wow, it was years ago :). You can build it without Intel compiler using GCC (https://stackoverflow.com/q/18141941/2865997). For multiple threads any multi-threaded Java lib should be OK, you can also search for tutorials on writing Java threads from scratch. Keep in mind I built it for a pretty old device (architecture might be different now) and it was only an experiment that resulted in a really poor performance. – Artur Malinowski Jun 09 '20 at 09:58
1

While it is certainly a long way from being able to run Java on Xeon Phi cores, one possible way to relatively easily get Xeon-support in your Java program would be to use Aparapi (https://github.com/aparapi/aparapi), a library which can cross-compile a subset of java byte code to OpenCL at runtime and execute it as an OpenCL kernel (Xeon Phi supports OpenCL, as does any modern GPU).

It is a non-trivial process to convert existing Java code to run as Aparapi Kernels (the code called from the Kernel run() method itself needs to be essentially Object-free - fields, parameters and locals must be primitives or arrays of primitives). But if the number of bottlenecks requiring massive parallelisation is low, it will probably not be a tremendous hassle to achieve this.

This would also allow your project to benefit from massive parallelisation on other supercomputing hardware (like Nvidia Tesla).

My suspicion is that running "any old" Java on Xeon Phi is unlikely to ever be supported, and that even if it were, the optimisation of OpenCL on Phi would remain far superior.

barneypitt
  • 979
  • 9
  • 11