Skip to main content

SIMD/Parallel processing support for Java

6 replies [Last post]
dog
Offline
Joined: 2003-08-22

Just read this article:
http://www.informit.com/articles/printerfriendly.asp?p=486104&rl=1

It was talking about high vs low level. It pointed out a flaw in Java regarding lack of SIMD support for modern architectures.

If there were some sort of new "array" construct in Java that would allow you to operate on it as a single object, then different VMs could take advantage of SIMD instructions on the CPUs to make set opertations very fast and take better advantage of the CPUs.

OBJECTIVE
Speeeeed! Why limit ourselves to single threads when we could be exploiting parallelism in current CPUs and in newer CPUs like multi-core CPUs etc..

Also applies to VMs for multiprocessors.

IMPLEMENTATION
I dunno.. look at the literature for parallel processing. There are plenty of abstractions for this sort of thing proposed for parallel languajes. Stuff like 2-dimensional "arrays" on which you can perform operations (the whole "array" supports the operation.. I'm not talking about going through the array with a for loop.. but instead doing it in parallel)

TARGET AUDIENCE
This would mainly be used by people developing APIs like faster ArrayLists, faster Sets, faster Matrices, faster image processing, etc..

Some aspects of the Java API could be reimplemented to take advantage of this by using the new abstraction so that they run much faster.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
olsonje
Offline
Joined: 2005-08-10

dog:
1) I can definatly understand that.
2) Sorry, that syntax just made me want to, well.. nm :)

chris:
Awesome, much love for you all at Sun working on this stuff!

dog
Offline
Joined: 2003-08-22

Just a clarification (before someone flames me):

the objective of this is so that programmers DON'T have to worry about the architecture specific details, but instead just use higher level instructions to operate on chunks of data when implementing basic APIs. Then if a particular CPU doesn't support it, the operation is done sequentially (like a for look). But otherwise it's done in parallel.

Another crazy idea would be to look for code like this:

for (i : myArray) {
}

and automagically transform it into a parallel operation (but there are probably some issues with that).

olsonje
Offline
Joined: 2005-08-10

I don't mean to come off as negative or anything but two things...
1) Have you ever done any parallel processing before?
2) Not only no, but hell no to that syntax!!

dog
Offline
Joined: 2003-08-22

> I don't mean to come off as negative or anything but
> two things...
> 1) Have you ever done any parallel processing
> before?

Absolutely not.. I have never done it. But I'd like to be able to leverage it using a language like Java.

> 2) Not only no, but hell no to that syntax!!

It isn't a proposed syntax.. its just to convey the idea.

I'm sure there are plenty of smart people around that can propose how to achieve this. Java should borrow from languages designed for this purpose.

Or maybe a Map/Reduce like thing.. or something similar to Arrays.arraycopy().. or a class that does all this.

campbell
Offline
Joined: 2003-06-24

It seems that you've already found the following thread, but just for the record, the general idea of using SIMD instructions in HotSpot and the JDK in general is discussed here:
http://forums.java.net/jive/thread.jspa?threadID=14597&tstart=0

I've been doing a bit more experimentation in this area in the past few weeks. No concrete results to report yet, but rest assured that we're giving it all some thought.

Chris

gkw
Offline
Joined: 2003-06-10

I would certainly like to see some autovectorization in the jre. It would help the javagaming folk alot. Thanks for trying to make something happen.