这个线性求解器如何在 Mathematica 中链接?
这是一个很好的线性求解器,名为 GotoBLAS。它可供下载并在大多数计算平台上运行。我的问题是,是否有一种简单的方法可以将此求解器与 Mathematica 内核链接起来,以便我们可以像 LinearSolve 一样调用它?你们大多数人可能肯定同意的一件事是,如果我们有一个非常大的线性系统,那么我们最好通过一些行业标准线性求解器来解决它。内置求解器不适用于真正的大问题。
现在 Mathematica 8 已经提供了更好的编译和库链接功能,我们可以期望使用 Mathematica 中的一些求解器。问题是这是否需要对源代码进行少量调整,或者您需要成为高级向导才能做到这一点。在这个论坛上,我们可以开始将一些优秀的开源程序(例如 GotoBLAS)与 Mathematica 联系起来并交换我们的观点。经验不足的人可以从专业用户那里获得一些见解,最终我们得到一个更强大的 Mathematica。这将是一个针对不断增长的 Mathematica 社区的开放项目,也是一个可以为未来用户透明记录 Mathematica 8 新引入的功能的平台。
我希望你们中的一些人能够就如何在 Mathematica 中运行 GotoBLAS 提供可靠的想法。由于较新的编译和库链接功能通常没有很好的文档记录,因此普通用户不经常使用它们。这个问题可以作为一个玩具示例来记录 Mathematica 的这些新功能。经验丰富的论坛成员在这个方向上的帮助将真正提高像我这样的新用户的积极性,并且它将教会我们扩展 Mathematica 的数字处理库的非常有用的东西。
Here is a good linear solver named GotoBLAS. It is available for download and runs on most computing platforms. My question is, is there an easy way to link this solver with the Mathematica kernel, so that we can call it like LinearSolve? One thing most of you may agree on for sure is that if we have a very large Linear system then we better get it solved by some industry standard Linear solver. The inbuilt solver is not meant for really large problems.
Now that Mathematica 8 has come up with better compilation and library link capabilities we can expect to use some of those solvers from within Mathematica. The question is does that require little tuning of the source code, or you need to be an advanced wizard to do it. Here in this forum we may start linking some excellent open source programs like GotoBLAS with Mathematica and exchange our views. Less experienced people can get some insight from the pro users and at the end we get a much stronger Mathematica. It will be an open project for the ever increasing Mathematica community and a platform where these newly introduced capabilities of Mathematica 8 could be transparently documented for future users.
I hope some of you here will give solid ideas on how we can get GotoBLAS running from within Mathematica. As the newer compilation and library link capabilities are usually not very well documented, they are not used by the common users very often. This question can act as a toy example to document these new capabilities of Mathematica. Help in this direction by the experienced forum members will really lift the motivation of new users like me as well as it will teach us a very useful thing to extend Mathematica's number crunching arsenal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为简短的答案是,这不是您真正想做的事情。
据我了解,GotoBLAS 是 BLAS 的具体实现,BLAS 代表基本线性代数子例程。 “基本”在这里实际上意味着非常基本 - 例如,将矩阵乘以向量。因此,BLAS 不是像
LinearSolve
这样的函数会调用的求解器。 LinearSolve 将(取决于参数的确切形式)调用 LAPACK 命令,这是构建在 BLAS 之上的更高级别的包。因此,要真正将 GotoBLAS(或任何 BLAS)链接到 Mathematica 中,确实需要重新编译整个内核。当然,人们可以编写一个针对 GotoBLAS 编译的 C/Fortran 程序,然后将其链接到 Mathematica 中。然而,生成的程序仅在运行链接到 Mathematica 的任何特定命令时才使用 GotoBLAS,这恰恰忽略了 BLAS 的全部意义。
The short answer, I think, is that this is not something you really want to do.
GotoBLAS, as I understand it, is a specific implementation of BLAS, which stands for Basic Linear Algebra Subroutines. "Basic" really means quite basic here - multiply a matrix times a vector, for example. Thus, BLAS is not a solver that a function like
LinearSolve
would call.LinearSolve
would (depending on the exact form of the arguments) call a LAPACK command, which is a higher level package built on top of BLAS. Thus, to really link GotoBLAS (or any BLAS) into Mathematica, one would really need to recompile the whole kernel.Of course, one could write a C/Fortran program that was compiled against GotoBLAS and then link that into Mathematica. The resulting program would only use GotoBLAS when running whatever specific commands you've linked into Mathematica, however, which rather misses the whole point of BLAS.
Wolfram 内核 (Mathematica) 已链接到高度优化的英特尔数学内核库,并随 Mathematica 一起分发。 MKL 是多线程和矢量化的,所以我不确定 GotoBLAS 会改进什么。
The Wolfram Kernel (Mathematica) is already linked to the highly-optimized Intel Math Kernel Library, and is distributed with Mathematica. The MKL is multithreaded and vectorized, so I'm not sure what GotoBLAS would improve upon.