无法使用mpirun的所有核心

问题描述 投票:4回答:2

我正在我的桌面上测试一个简单的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个处理器。我对超额订阅不感兴趣,我只是想能够使用我所有的处理器。有人可以帮忙吗?

mpi openmpi hpc
2个回答
10
投票

您的处理器有4个超线程但只有2个内核(参见规格here)。

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

mpirun --use-hwthread-cpus ...

FWIW

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

找出机器拓扑结构的更好方法是通过lstopo包中的hwloc命令。

MPI任务不受OS X核心和线程的约束,因此如果您在Mac上运行,--oversubscribe -np 4将导致相同的结果。


0
投票

使用$ lscpu number of cores per socket * number of sockets会给你一些物理核心(你可以用于mpi的那些),其中sockets per core * number of sockets * threads per core会给你一些逻辑核心(你使用命令$ cat /proc/cpuinfo | grep processor | wc -l获得的核心)

© www.soinside.com 2019 - 2024. All rights reserved.