BigG
BigG

Reputation: 1011

java matrix-multiplication (FAST)

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?

Upvotes: 7

Views: 6773

Answers (5)

apete
apete

Reputation: 1320

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".

Upvotes: 0

High Performance Mark
High Performance Mark

Reputation: 78316

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.

Upvotes: -1

Hamaad Shah
Hamaad Shah

Reputation: 31

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.

Upvotes: 3

Adam Goode
Adam Goode

Reputation: 7468

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.

Upvotes: 4

Hamish Grubijan
Hamish Grubijan

Reputation: 10820

Do it on a GPU? http://www.nvidia.com/object/io_1254288141829.html

Upvotes: 1

Related Questions