gpt4 book ai didi

mpi - 无法通过 mpirun 使用所有核心

转载 作者:行者123 更新时间:2023-12-02 04:13:15 24 4
gpt4 key购买 nike

我正在桌面上测试一个简单的 MPI 程序(Ubuntu LTS 16.04/Intel® Core™ i3-6100U CPU @ 2.30GHz × 4/gcc 4.8.5/OpenMPI 3.0.0),但 mpirun 不允许使用我机器上的所有核心 (4)。当我运行时:

$ mpirun -n 4 ./test2

我收到以下错误:

--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 4 slots
that were requested by the application:
./test2

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

但是如果我运行:

$ mpirun -n 2 ./test2

一切正常。

我从其他答案中看到,我可以使用它来检查处理器的数量

cat /proc/cpuinfo | grep processor | wc -l

这告诉我我有 4 个处理器。我对超额订阅感兴趣,我只想能够使用我的所有处理器。有人可以帮忙吗?

最佳答案

您的处理器有 4 个超线程,但只有 2 个核心(请参阅规范 here)。

默认情况下,Open MPI 每个核心不会运行多个 MPI 任务。您可以使用以下选项让 Open MPI 每个超线程最多运行一个 MPI 任务

mpirun --use-hwthread-cpus ...

FWIW

您提到的命令报告超线程的数量。

了解机器拓扑的更好方法是通过 hwloc 包中的 lstopo 命令。

在 OS X 上,MPI 任务不绑定(bind)在内核或线程上,因此,如果您在 Mac 上运行,--oversubscribe -np 4 将导致相同的结果。

关于mpi - 无法通过 mpirun 使用所有核心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48835603/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com