通常,当我使用mpirun时,可以使用比计算机上实际可用数量更多的处理器来“过载”它。例如,在我的四核Mac上,我可以运行mpirun -np 29 python -c "print 'hey'"没问题。我现在在另一台计算机上,这将引发以下错误:

$ mpirun -np 25 python -c "print 'hey'"
--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 25 slots
that were requested by the application:
  python

Either request fewer slots for your application, or make more slots available
for use.
--------------------------------------------------------------------------

为什么“超频” mpirun在这里不起作用?有没有一种方法可以克服此错误消息,并成功使用比可用处理器更多的处理器运行?

最佳答案

根据https://www.open-mpi.org/faq/?category=running#oversubscribing的说法,您可以使用主机文件超额订购节点。在继续操作之前,请注意,这种方式会严重降低节点的性能。另外,如果您用于运行应用程序的系统使用的是队列系统,则这可能无效。

首先创建一个包含以下内容的主机文件(名为主机文件)

localhost slots=25

像这样简单地运行您的应用程序
mpirun --hostfile hostfile -np 25 python -c "print 'hey'"

09-08 04:39