【发布时间】:2012-04-29 11:41:17
【问题描述】:
我“双启动”Ubuntu 11.04、Ubuntu 12.04 和 Windows XP SP3 均已更新至最新版本。 PC 是相当旧的 Intel Celeron D CPU 3.06GHz 和 2GB RAM
在 Ubuntu 11.04 中,我使用 ATLAS 编译了 Numpy(ATLAS 从源代码编译)
在 Ubuntu 12.04 中,我使用最新的可用 MKL、icc、ifort 构建了 Numpy
在 Windows XP 中,我有带 MKL 的 Numpy(来自 Christoph Gohlke 提供的 Python 包)
更多细节在这里:http://pastebin.com/raw.php?i=wxuFbyVg
我试过很简单:%timeit np.dot(np.ones((1000,1000)), np.ones((1000,1000)))
得到了这个结果:
Ubuntu ATLAS: 1 loops, best of 3: 457 ms per loop
Windows MKL: 1 loops, best of 3: 680 ms per loop
Ubuntu MKL: 1 loops, best of 3: 1.04 s per loop
我认为上面是一个不好的例子,我搜索了许多可用的比较之一,即第一个谷歌点击:http://dpinte.wordpress.com/2010/01/15/numpy-performance-improvement-with-the-mkl/
我测试了相同的功能:
%timeit test_eigenvalue()
Ubuntu Atlas: 1 loops, best of 3: 6.38 s per loop
Windows MKL: 1 loops, best of 3: 2.22 s per loop
Ubuntu MKL: 1 loops, best of 3: 3.58 s per loop
%timeit test_svd()
Ubuntu Atlas: 1 loops, best of 3: 2.13 s per loop
Windows MKL: 1 loops, best of 3: 2.06 s per loop
Ubuntu MKL: 1 loops, best of 3: 3.09 s per loop
%timeit test_inv()
Ubuntu Atlas: 1 loops, best of 3: 964 ms per loop
Windows MKL: 1 loops, best of 3: 1.02 s per loop
Ubuntu MKL: 1 loops, best of 3: 1.59 s per loop
%timeit test_det()
Ubuntu Atlas: 1 loops, best of 3: 308 ms per loop
Windows MKL: 1 loops, best of 3: 322 ms per loop
Ubuntu MKL: 1 loops, best of 3: 491 ms per loop
%timeit test_dot()
Ubuntu Atlas: 1 loops, best of 3: 1.5 s per loop
Windows MKL: 1 loops, best of 3: 1.77 s per loop
Ubuntu MKL: 1 loops, best of 3: 2.77 s per loop
因此,ATLAS 编译的 Numpy 出于某种原因具有最佳结果。
有谁知道可能是什么问题?
【问题讨论】:
-
可能最新版本的 MKL 已针对现代 Intel CPU 进行了优化,而从源代码编译的 atlas 将始终针对您的特定系统进行自我调整。
-
可能是的。我知道 Ubuntu MKL 版本较慢,因为我遵循英特尔 numpy 页面的说明,而不是至少针对单个 CPU 进行调整。但是,我会在 Ubuntu 12.04 numpy 版本上使用 ATLAS,而不是让整个系统复杂化,并在未来注意不要盲目地遵循我阅读的所有内容