简体   繁体   English

java矩阵乘法(FAST)

[英]java matrix-multiplication (FAST)

I have to multiply 2 (most of the times) sparse matrix. 我必须乘以2(大多数时候)稀疏矩阵。 Those matrix are pretty bit (about 10k*10k) and i've a two Xeon Quad core and just one thread for this job? 那些矩阵很有点(大约10k * 10k),我有一个两个Xeon Quad核心,只有一个线程用于这项工作?

is there any fast library for multi-thread moltiplication? 是否存在用于多线程moltiplication的快速库? any other advice? 还有其他建议吗?

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 . 对于并行处理,请尝试较新的Parallel Colt

With due respect to Colt and Parallel Colt, they are not very fast. 考虑到Colt和Parallel Colt,它们并不是很快。 If you insist on using Java and expect fast numerical computations, use JBLAS. 如果您坚持使用Java并期望快速数值计算,请使用JBLAS。 JBLAS uses ATLAS. JBLAS使用ATLAS。 I have compiled JBLAS to use multithreaded ATLAS - it does not do this by default. 我已编译JBLAS以使用多线程ATLAS - 默认情况下它不会这样做。 You would need to change a few configure options. 您需要更改一些配置选项。 However even single threaded JBLAS is faster than multithreaded Colt and Parallel Colt. 然而,即使是单线程JBLAS也比多线程Colt和Parallel Colt更快。 I tested Colt, Parallel Colt, JAMA and JBLAS. 我测试了Colt,Parallel Colt,JAMA和JBLAS。 JBLAS is the best by a country mile. JBLAS是一个国家英里最好的。

Colt and Parallel Colt are very slow. 柯尔特和平行柯尔特非常慢。 So is JAMA. JAMA也是如此。 The best library in Java for such things is JBLAS. Java中用于此类事物的最佳库是JBLAS。

Did you look at the Java Matrix Benchmark ? 您是否看过Java Matrix Benchmark It compares performance between several of the most common java linear algebra packages - including a couple that use/call native code. 它比较了几种最常见的java线性代数包之间的性能 - 包括一对使用/调用本机代码的程序包。 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". 使用纯Java实现可以获得非常好的性能,但如果您希望使用大型矩阵获得最佳性能,则必须“离开JVM”。

Yes, there are libraries for multi-threaded matrix multiplication; 是的,有用于多线程矩阵乘法的库; let Google be your friend. 让Google成为你的朋友。 Though if you only have one thread multithreading may not be necessary. 虽然如果你只有一个线程多线程可能没有必要。 Why do you have only one thread on an 8-core machine ? 为什么8核机器上只有一个线程? One library to consider is the Java BLAS interface. 要考虑的一个库是Java BLAS接口。

You're definitely taking the right approach, looking for a library rather than trying to write this yourself. 你肯定采取正确的方法,寻找一个图书馆,而不是自己写这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM