Java矩阵数学库的性能? [英] Performance of Java matrix math libraries?

查看:223
本文介绍了Java矩阵数学库的性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在计算运行时受矩阵运算约束的东西。 (如果感兴趣,请参阅下面的一些细节。)这次经历提出了以下问题:

We are computing something whose runtime is bound by matrix operations. (Some details below if interested.) This experience prompted the following question:

民众对矩阵数学的Java库的性能有经验(例如,乘法,逆,等等。)?例如:

Do folk have experience with the performance of Java libraries for matrix math (e.g., multiply, inverse, etc.)? For example:

  • JAMA
  • COLT
  • Apache commons math

我搜索后一无所获。

我们的速度详情比较:

我们使用的是英特尔FORTRAN(ifort(IFORT)10.1 20070913)。我们使用Apache commons math 1.2矩阵运算在Java(1.6)中重新实现了它,并且它同意所有的精度数字。 (我们有理由在Java中想要它。)(Java双打,Fortran真实* 8)。 Fortran:6分钟,Java 33分钟,同一台机器。 jvisualm profiling显示了在RealMatrixImpl中花费了大量时间。{getEntry,isValidCoordinate}(在未发布的Apache commons math 2.0中似乎已经消失了,但2.0并不快)。 Fortran正在使用Atlas BLAS例程(dpotrf等)。

We are using Intel FORTRAN (ifort (IFORT) 10.1 20070913). We have reimplemented it in Java (1.6) using Apache commons math 1.2 matrix ops, and it agrees to all of its digits of accuracy. (We have reasons for wanting it in Java.) (Java doubles, Fortran real*8). Fortran: 6 minutes, Java 33 minutes, same machine. jvisualm profiling shows much time spent in RealMatrixImpl.{getEntry,isValidCoordinate} (which appear to be gone in unreleased Apache commons math 2.0, but 2.0 is no faster). Fortran is using Atlas BLAS routines (dpotrf, etc.).

显然这可能取决于我们在每种语言中的代码,但我们相信大部分时间都在等效矩阵中操作。

Obviously this could depend on our code in each language, but we believe most of the time is in equivalent matrix operations.

在其他一些不涉及库的计算中,Java速度并不慢,有时速度更快。

In several other computations that do not involve libraries, Java has not been much slower, and sometimes much faster.

推荐答案

加上我的2美分。我比较了其中一些库。我试图矩阵乘以3000乘3000矩阵的双精度。结果如下。

Just to add my 2 cents. I've compared some of these libraries. I attempted to matrix multiply a 3000 by 3000 matrix of doubles with itself. The results are as follows.

使用带有C / C ++,Octave,Python和R的多线程ATLAS,所花费的时间大约为4秒。

Using multithreaded ATLAS with C/C++, Octave, Python and R, the time taken was around 4 seconds.

使用Jama和Java,花费的时间是50秒。

Using Jama with Java, the time taken was 50 seconds.

将Colt和Parallel Colt与Java一起使用时间为150秒!

Using Colt and Parallel Colt with Java, the time taken was 150 seconds!

在JBLAS使用多线程ATLAS的情况下,将JBLAS与Java一起使用时间大约为4秒。

Using JBLAS with Java, the time taken was again around 4 seconds as JBLAS uses multithreaded ATLAS.

所以对我来说很明显,Java库的表现并不好。但是,如果有人必须使用Java编写代码,那么最好的选择是JBLAS。贾马,科尔特和平行柯尔特并不快。

So for me it was clear that the Java libraries didn't perform too well. However if someone has to code in Java, then the best option is JBLAS. Jama, Colt and Parallel Colt are not fast.

这篇关于Java矩阵数学库的性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆