OpenMPI 和 rank/core 绑定

OpenMPI and rank/core bindings

我在使用 OpenMPI 时遇到问题,其中不同的 MPI 等级重复绑定到相同的 CPU 内核。

我使用的服务器有 32 个硬件内核(无超线程),Ubuntu 14.04.2 LTS 和 OpenMPI 1.8.4,使用 Intel 编译器 15.0.1 编译。

例如,我可以 运行 我的可执行文件具有 8 个 MPI 级别,并获得以下级别的核心绑定,

$ mpirun -n 8 --report-bindings ./executable
[simple:16778] MCW rank 4 bound to socket 0[core 1[hwt 0]]: [./B/./././././.][./././././././.][./././././././.][./././././././.]
[simple:16778] MCW rank 5 bound to socket 1[core 9[hwt 0]]: [./././././././.][./B/./././././.][./././././././.][./././././././.]
[simple:16778] MCW rank 6 bound to socket 2[core 17[hwt 0]]: [./././././././.][./././././././.][./B/./././././.][./././././././.]
[simple:16778] MCW rank 7 bound to socket 3[core 25[hwt 0]]: [./././././././.][./././././././.][./././././././.][./B/./././././.]
[simple:16778] MCW rank 0 bound to socket 0[core 0[hwt 0]]: [B/././././././.][./././././././.][./././././././.][./././././././.]
[simple:16778] MCW rank 1 bound to socket 1[core 8[hwt 0]]: [./././././././.][B/././././././.][./././././././.][./././././././.]
[simple:16778] MCW rank 2 bound to socket 2[core 16[hwt 0]]: [./././././././.][./././././././.][B/././././././.][./././././././.]
[simple:16778] MCW rank 3 bound to socket 3[core 24[hwt 0]]: [./././././././.][./././././././.][./././././././.][B/././././././.]

按预期工作。

问题是,如果我第二次 运行 这个命令(在不同的文件夹中执行 运行),我会再次得到完全相同的绑定。这意味着在 32 CPU 个核心中,8 个将有两次负载,而其余 24 个将不执行任何操作。

我知道 mpirun 的不同 options 通过核心、套接字等进行绑定。例如,我可以明确指定应与 --cpu-set 一起使用的核心争论,或者更一般地说,有排名政策,

--rank-by Ranking Policy [slot (default) | hwthread | core | socket | numa | board | node]

相反,我正在寻找的是一种自动将负载分配到空闲的 CPU 核心上的方法,并且不会重复使用相同的核心两次。有什么政策可以控制这个吗?

您是否运行同时安装可执行文件?如果不是,您的系统的行为似乎很合乎逻辑。 如果您想同时 运行 两个实例并确保它们 运行 在不同的内核上运行,您可以尝试这样的事情:

numactl physcpubind=0-7 mpirun -n 8 --report-bindings ./executable &

numactl pyscpubind=8-31 mpirun -n 24 --report-bindings ./executable