由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - openblas怎么比base blas还慢呢?
相关主题
這個有用麼?问个选语言的问题
Matrix calculation in C++150行 F# 做矩阵运算比MKL还快
gnu c++ 自带的库能解矩阵方程吗?求救:2个dense matrix的乘法
谁在Xeon Phi上用过MKL请问大家一个eclipse CDT的问题 (转载)
日本人做科研的style (转载)用多线程怎么比单线程还慢呢?
震惊:java 的矩阵操作比 c++ 快?welly比web还慢
为什么好多ID 见到 c++就好象 不共戴天呢?int这种类型的存在意义是什么?
为啥matlab一直用列优先存储来存储array?魏老师聊聊FPGA吧
相关话题的讨论汇总
话题: blas话题: openblas话题: atlas话题: mkl话题: parameters
进入Programming版参与讨论
1 (共1页)
G**Y
发帖数: 33224
1
Ubuntu 12.04 LTS
Lenovo W530
Ubuntu in VirtualBox
w***g
发帖数: 5958
2
你没设对。我遇到过一次这个情况,见下面的帖子。
开始的结果,OpenBlas比MKL和Atlas都要慢n倍:
http://www.wdong.org/wordpress/blog/2013/08/30/mkl-vs-atlas-vs-
设对以后,OpenBLAS基本上可以匹敌MKL.
http://www.wdong.org/wordpress/blog/2013/09/01/openblas%E9%80%8
不过你在virtualbox里跑OpenBLAS这个比较搞笑,性能可能会差不少。

【在 G**Y 的大作中提到】
: Ubuntu 12.04 LTS
: Lenovo W530
: Ubuntu in VirtualBox

G**Y
发帖数: 33224
3
嗯。
似乎virtualbox上要自己build。

【在 w***g 的大作中提到】
: 你没设对。我遇到过一次这个情况,见下面的帖子。
: 开始的结果,OpenBlas比MKL和Atlas都要慢n倍:
: http://www.wdong.org/wordpress/blog/2013/08/30/mkl-vs-atlas-vs-
: 设对以后,OpenBLAS基本上可以匹敌MKL.
: http://www.wdong.org/wordpress/blog/2013/09/01/openblas%E9%80%8
: 不过你在virtualbox里跑OpenBLAS这个比较搞笑,性能可能会差不少。

G**Y
发帖数: 33224
4
run了一些test,有些项目快很多,有些项目慢很多。
对这些compile的flags不是很懂。

【在 w***g 的大作中提到】
: 你没设对。我遇到过一次这个情况,见下面的帖子。
: 开始的结果,OpenBlas比MKL和Atlas都要慢n倍:
: http://www.wdong.org/wordpress/blog/2013/08/30/mkl-vs-atlas-vs-
: 设对以后,OpenBLAS基本上可以匹敌MKL.
: http://www.wdong.org/wordpress/blog/2013/09/01/openblas%E9%80%8
: 不过你在virtualbox里跑OpenBLAS这个比较搞笑,性能可能会差不少。

d********f
发帖数: 43471
5
这种东西你要结合算法和代码来分析,不要和全堆程序员一样,动不动xx真好用,xxx
真不行

【在 G**Y 的大作中提到】
: run了一些test,有些项目快很多,有些项目慢很多。
: 对这些compile的flags不是很懂。

L***s
发帖数: 1148
6

I used to compile and install ATLAS,
and I was aware of two kinds of optimization:
1. Matrix/vector multiplication is done at the block-level,
as opposed to element-wise. So it has to be knowledgeable
on your memory hierarchy, e.g., speed and sizes of your
register, L1/L2/L3 caches, main memory, etc.
ATLAS picks the best preset parameters accordingly.
2. ATLAS performs local search on the best preset parameters,
conducts actual performance profiling, and picks the best set
of empirical parameters at the end.
These happen when compiling ATLAS on your machine;
the best parameters have to be hard-coded in the compiled
binaries for the sake of performance.
The BLAS/LAPACK (e.g., gotoBLAS, ATLAS, MKL) you downloaded
from your distro repos are often of binary forms,
thus carry only conservative parameters. Therefore,
it is not uncommon that the well-known performant BLAS
(e.g., MKL) downloaded as binaries cannot out-perform
less performant BLAS that you compile on your own machine.
I don't have experience with OpenBLAS or BaseBLAS.
But the knowledge may translate.

【在 G**Y 的大作中提到】
: Ubuntu 12.04 LTS
: Lenovo W530
: Ubuntu in VirtualBox

L***s
发帖数: 1148
7

There are a lots of things to be aware of when compiling BLAS.
For instance, you should at least make sure that
your CPU multiplier is fixed at the max value
during the whole compiling/profiling process.
If compiled/profiled poorly, it is not impossible
that the resulting binaries perform much worse
than the (same) BLAS that you would download in
the binary form with conservative parameters.

【在 G**Y 的大作中提到】
: run了一些test,有些项目快很多,有些项目慢很多。
: 对这些compile的flags不是很懂。

G**Y
发帖数: 33224
8
自己瞎编了一次openblas,没快多少似乎还有bug (运算结果不对)
决定放弃了。Intel的MKL有免费的吗?
我比了一天,根据binary的情况:
小矩阵运算(20x20之类的),base往往最快。矩阵大了以后atlas和openblas就快很多
了。
但是openblas的multi thread很慢。(我用R测试的,我的R可能是单线程的)。
我的程序刚好是大量的小矩阵,似乎这些NB的blas也没用。
另外我在virtualbox里面跑,不支持AVX。
这东西折腾起来太费劲了。我还是再等等算了。

【在 L***s 的大作中提到】
:
: There are a lots of things to be aware of when compiling BLAS.
: For instance, you should at least make sure that
: your CPU multiplier is fixed at the max value
: during the whole compiling/profiling process.
: If compiled/profiled poorly, it is not impossible
: that the resulting binaries perform much worse
: than the (same) BLAS that you would download in
: the binary form with conservative parameters.

m********5
发帖数: 17667
9
别折腾了用MKL吧
这个基本都是最快的
另外,在Vbox里面用就是瞎搞,还不如不用
MKL经常都是免费的,偶尔抽风某些版本要收钱

【在 G**Y 的大作中提到】
: Ubuntu 12.04 LTS
: Lenovo W530
: Ubuntu in VirtualBox

h*******u
发帖数: 15326
10
mkl只有30天免费

【在 m********5 的大作中提到】
: 别折腾了用MKL吧
: 这个基本都是最快的
: 另外,在Vbox里面用就是瞎搞,还不如不用
: MKL经常都是免费的,偶尔抽风某些版本要收钱

相关主题
震惊:java 的矩阵操作比 c++ 快?问个选语言的问题
为什么好多ID 见到 c++就好象 不共戴天呢?150行 F# 做矩阵运算比MKL还快
为啥matlab一直用列优先存储来存储array?求救:2个dense matrix的乘法
进入Programming版参与讨论
G**Y
发帖数: 33224
11
我昨天下了一个MKL,好几百兆,似乎也不能再Virtualbox跑。我就不折腾了。
似乎很多人发现openblas在小矩阵的时候慢:
https://github.com/JuliaLang/julia/issues/3239
似乎MKL在小矩阵的时候也一般。
看来我还是找些naiive并行的东西

【在 h*******u 的大作中提到】
: mkl只有30天免费
h*******u
发帖数: 15326
12
小矩阵还折腾啥呢
我现在要搞的10000*10000以上

【在 G**Y 的大作中提到】
: 我昨天下了一个MKL,好几百兆,似乎也不能再Virtualbox跑。我就不折腾了。
: 似乎很多人发现openblas在小矩阵的时候慢:
: https://github.com/JuliaLang/julia/issues/3239
: 似乎MKL在小矩阵的时候也一般。
: 看来我还是找些naiive并行的东西

G**Y
发帖数: 33224
13
我们的问题往往是一个简单的运算重复几万遍。

【在 h*******u 的大作中提到】
: 小矩阵还折腾啥呢
: 我现在要搞的10000*10000以上

h*******u
发帖数: 15326
14
你试试Xeon phi. 一个mic上可以跑200多线程,还是x86的。
我现在还没搞明白怎么用

【在 G**Y 的大作中提到】
: 我们的问题往往是一个简单的运算重复几万遍。
G**Y
发帖数: 33224
15
这是gpu computing吗?那就折腾了,估计要tune你的code吧。
据说tune的很好的gpu code,也就提高4-5倍。
毕竟其几百个线程,overhead太多。
我不理解的是为啥openblas即使单线程,似乎overhead也很大。不过前面说了,在
virtualbox上跑,可能有很多别的问题。看来需要新硬件。

【在 h*******u 的大作中提到】
: 你试试Xeon phi. 一个mic上可以跑200多线程,还是x86的。
: 我现在还没搞明白怎么用

m********5
发帖数: 17667
16
现在改了? 我以前用Non-Commercial执照可以一直用啊

【在 h*******u 的大作中提到】
: mkl只有30天免费
m********5
发帖数: 17667
17
那应该更没必要了
overhead够喝一壶

【在 G**Y 的大作中提到】
: 我们的问题往往是一个简单的运算重复几万遍。
N******K
发帖数: 10202
18
矩阵 内存反复申请释放 是耗时间的
你应该在这方面下功夫 比如复用一些矩阵 作为临时变量

【在 G**Y 的大作中提到】
: 我们的问题往往是一个简单的运算重复几万遍。
1 (共1页)
进入Programming版参与讨论
相关主题
魏老师聊聊FPGA吧日本人做科研的style (转载)
看了那个招聘的帖子,自觉需要把 atoi温习一下。赶紧的震惊:java 的矩阵操作比 c++ 快?
goodbug劝你一句,不作不死为什么好多ID 见到 c++就好象 不共戴天呢?
intel knights landing 72core CPU 谁用过?为啥matlab一直用列优先存储来存储array?
這個有用麼?问个选语言的问题
Matrix calculation in C++150行 F# 做矩阵运算比MKL还快
gnu c++ 自带的库能解矩阵方程吗?求救:2个dense matrix的乘法
谁在Xeon Phi上用过MKL请问大家一个eclipse CDT的问题 (转载)
相关话题的讨论汇总
话题: blas话题: openblas话题: atlas话题: mkl话题: parameters