views:

659

answers:

4

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?

+1  A: 

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

Hamish Grubijan
i have 8 cores 2,6GHz and i use just one of them
BigG
http://jscience.org/
Hamish Grubijan
If you're doing single-precision multiplication, a GPGPU implementation running on a good graphics card may *still* beat the 8 cores. GPGPU can be from 10x to 100x faster than CPU, since it has so many stream processors (hundreds in modern chips).
BobMcGee
good to know. thank you Bob
BigG
A: 

Hi

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.

Regards

Mark

High Performance Mark
+3  A: 

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.

Adam Goode
Exactly what I was about to post.
BobMcGee
are you sure i can create a matrix 10k*10k?
BigG
Sure, that's only 800 MB (for double). Make sure you are using a 64-bit JVM.
Adam Goode
Oh, and it's sparse. No problem.
Adam Goode
Parallel Colt rocks
BigG
A: 

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.

Hamaad Shah