Question

I have to multiply 2 (most of the times) sparse matrix. Those matrix are pretty bit (about 10k*10k) and i've a two Xeon Quad core and just one thread for this job?

is there any fast library for multi-thread moltiplication? any other advice?

Was it helpful?

Solution

I would try Colt, from CERN. It's a bit old now, but still provides excellent libraries for what you are trying.

For parallel processing, try the newer Parallel Colt.

OTHER TIPS

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 have compiled JBLAS to use multithreaded ATLAS - it does not do this by default. You would need to change a few configure options. However even single threaded JBLAS is faster than multithreaded Colt and Parallel Colt. I tested Colt, Parallel Colt, JAMA and JBLAS. JBLAS is the best by a country mile.

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

Did you look at the Java Matrix Benchmark? It compares performance between several of the most common java linear algebra packages - including a couple that use/call native code. Matrix multiplication is of course one of the things tested/compared and the latest benchmark execution was actually done a dual Quad-Core Intel Xeon machine.

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

It's possible to get very good performance with a pure Java implementation, but if you want the best possible performance with matrices that big you have to "leave the JVM".

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

You're definitely taking the right approach, looking for a library rather than trying to write this yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top