我必须在某些算法中利用 PpenMP,为此我需要一些数学函数,例如MATLAB 中可用的eig
或者svd
它在 MATLAB 中非常快。我已经使用 OpenMP 尝试了以下库
但我不知道为什么我的 OpenMP 并行代码比串行代码慢得多,可能是库中有问题,或者函数random
,eig
或者svd
阻塞?我不知道如何弄清楚,有人可以建议我哪个与 OpenMP 最兼容的数学库。
我必须在某些算法中利用 PpenMP,为此我需要一些数学函数,例如MATLAB 中可用的eig
或者svd
它在 MATLAB 中非常快。我已经使用 OpenMP 尝试了以下库
但我不知道为什么我的 OpenMP 并行代码比串行代码慢得多,可能是库中有问题,或者函数random
,eig
或者svd
阻塞?我不知道如何弄清楚,有人可以建议我哪个与 OpenMP 最兼容的数学库。
I can recommend Intel's MKL; note that it costs money which may affect your decision. I neither know nor care what language(s) it is written in, just so long as it provides APIs callable from my chosen language. Mine is Fortran, but it has bindings for C too
If you look around SO you'll find many questions from people whose first (or second or third) OpenMP programs were actually slower than their serial versions. Look at some of the answers. Don't conclude that there is a magic bullet, in the shape of a library, to make your code faster. Instead, realise that it is most likely that you've written a poorly-parallelised program and fix that.
Finally, if you have an installation of Matlab, don't expect to be able to write your own routines to outperform Matlab's. I won't say it can't be done, but I think you'll find it very difficult.
GSL 与 OpenMP 兼容。您可以试用免费试用版的英特尔数学内核库。如果加速不是那么快,那么代码可能无法并行化。您可能希望在英特尔线程检查器中调试并查看正在运行的线程的详细信息,这可能有助于了解瓶颈所在。