Java matrix-multiplication (FAST)

I need to multiply 2 (most of the time) a sparse matrix. These matrices are quite a bit (about 10k * 10k), and I have two Xeon Quad cores and only one thread for this to work?

Is there any quick library for multi-threaded tolerance? any other advice?

+6
java multithreading matrix-multiplication
source share
5 answers

I will try Colt , from CERN. This is a bit outdated, but still provides excellent libraries for what you are trying.

For parallel processing, try the new Parallel Colt .

+4
source share

With due respect to Colt and Parallel Colt, they are not very fast. If you insist on using Java and expect fast numerical computations, use JBLAS. JBLAS uses ATLAS. I compiled JBLAS to use multi-threaded ATLAS - it does not do this by default. You will need to change several configuration parameters. However, even single-threaded JBLAS are faster than multi-threaded Colt and Parallel Colt. I tested Colt, Parallel Colt, JAMA and JBLAS. JBLAS is the best mile in the country.

Colt and Parallel Colt are very slow. So is JAMA. The best Java library for such things is JBLAS.

+2
source share
+1
source share

Have you looked at the Java Matrix Benchmark ? It compares performance between several of the most common Java linear algebra packages, including a pair that uses / calls native code. Matrix multiplication is, of course, one of the tested / compared things, and in the latest reference version, a dual-core quad-core Intel Xeon was actually performed.

What you don't see is how these libraries work using sparse matrices (or if they support it at all).

It is possible to get very good performance with a clean Java implementation, but if you want to get the best possible performance with matrices, you need to "leave the JVM".

0
source share

Yes, there are libraries for multi-threaded matrix multiplication; let google be your friend. Although, if you have only one thread of multithreading, it may not be necessary. Why do you have only one thread on an 8-core computer? One library to consider is the Java BLAS interface.

You definitely take the right approach when looking for a library, rather than trying to write it yourself.

-one
source share

All Articles