Matlab 2011a 使用 64 位 Linux 上的所有可用内核?
您好,我在网上查看过,但我似乎找不到答案,是否需要做任何事情才能使 matlab 使用所有内核?据我了解,自 2007 年以来就支持多线程。在我的机器上,matlab 只使用一个核心 @100%,其余的则挂在 ~2%。我使用的是 64 位 Linux (Mint 12)。在我的另一台只有 2 个内核且 32 位的计算机上,Matlab 似乎 100% 地利用了两个内核。不是所有时候,但在足够多的情况下。在 64 位 4 核 PC 上,这种情况永远不会发生。
我是否必须在 64 位中做任何事情才能让 Matlab 尽可能使用所有内核?安装后我必须做一些自定义链接,因为 Matlab 没有找到库(例如 libc.so.6),因为它没有在正确的位置查找。
Hi I've looked online but I can't seem to find the answer whether I need to do anything to make matlab use all cores? From what I understand multi-threading has been supported since 2007. On my machine matlab only uses one core @100% and the rest hang at ~2%. I'm using a 64 bit Linux (Mint 12). On my other computer which has only 2 cores and is 32 bit Matlab seems to be utilizing both cores @100%. Not all of the time but in sufficient number of cases. On the 64 bit, 4 core PC this never happens.
Do I have to do anything in 64 bit to get Matlab to use all the cores whenever possible? I had to do some custom linking after install as Matlab wasn't finding the libraries (eg. libc.so.6) because it wasn't looking in the correct places.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
按照标准,自最新版本以来,您可以使用并行计算工具箱使用 12 个内核。如果没有这个工具箱,我想你就不走运了。任何额外的核心都可以通过 MATLAB 分布式计算服务器 访问,您实际上是按工作线程数付费的。
要让 matlab 使用您的多核,您必须这样做
如果您实际上有多线程代码(例如使用
spmd
函数或 parfor 循环),它当然效果更好更多信息 Matlab 主页
By standard, since the latest release, you can use 12 cores using the Parallel Computing Toolbox. Without this toolbox, I guess you're out of luck. Any additional cores could be accessed by the MATLAB Distributed Computing Server, where you actually pay per number of worker threads.
To make matlab use your multiple cores you have to do
And it of course works better if you actually have multithreaded code (like using the
spmd
function or parfor loops)More info at the Matlab homepage
MATLAB 只有一个用于计算的单线程。
也就是说,将为某些使用其底层使用的 BLAS 库的多线程功能的函数创建多个线程。
因此,如果您调用使用这些多线程 blas 库的函数,您将只能获得“多线程”优势。
此链接包含有关多线程函数列表。
现在,对于核心的使用,这取决于您的操作系统。我相信操作系统必须对线程进行负载平衡才能在所有核心上使用。无法从 MATLAB 内部设置与线程的关联性。不过,我们可以将 MATLAB 工作进程设置为与并行计算工具箱中的内核具有亲和力。
但是,您始终可以尝试通过以下链接中提供的详细信息手动设置 MATLAB 进程与所有处理器的关联性 Linux
Windows 用户只需右键单击任务管理器中的进程并设置关联性即可。
我的理解是,这只是对操作系统的请求,并不是操作系统必须遵守的硬约束规则。
MATLAB has only one single thread for Computation.
That said, multiple threads would be created for certain functions which use the multithreaded features of the BLAS libraries that it uses underneath.
Thus, you would only be able to gain a 'multi threaded' advantage if you are calling functions which use these multi-threaded blas libraries.
This link has information on the list of functions which are multithreaded.
Now for the use of your cores, that would depend on your OS. I believe the OS would have to load balance your threads to be used on all cores. One CANNOT set affinities to threads from within MATLAB. One can however set worker MATLAB processes to have affinities to cores from within the Parallel Computing toolbox.
However, you could always try setting the affinity for the MATLAB process to all your processors manually by the details available at the following link for Linux
Windows users can simply right click on the process in the task manager and set affinity.
My understanding is that this is only a request to the OS and is not a hard binding rule that the OS must adhere to.