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

查看:24
本文介绍了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:

我搜索了一下,一无所获.

I searched and found nothing.

我们的速度比较详情:

我们使用的是英特尔 FORTRAN(ifort (IFORT) 10.1 20070913).我们已经使用 Apache commons math 1.2 矩阵运算在 Java (1.6) 中重新实现了它,并且它同意其所有准确度数字.(我们有理由希望在 Java 中使用它.)(Java 翻倍,Fortran 实数*8).Fortran:6 分钟,Java 33 分钟,同一台机器.jvisualm 分析显示在 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.

在 Java 中使用 Jama,花费的时间为 50 秒.

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

在 Java 中使用 Colt 和 Parallel Colt,耗时 150 秒!

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

将 JBLAS 与 Java 结合使用,由于 JBLAS 使用多线程 ATLAS,所用时间再次约为 4 秒.

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

所以对我来说很明显 Java 库的表现不是很好.但是,如果有人必须用 Java 编写代码,那么最好的选择是 JBLAS.Jama、Colt 和 Parallel Colt 并不快.

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天全站免登陆