我想用OpenMPI 2.11执行我的程序的几个实例。每个实例都在我的集群上自己的节点(-N 1)上运行。这很好用。我现在想将每个程序实例固定到其节点的前2个核心。为此,看起来我需要使用rankfiles。这是我的rankfile:
rank 0=+n0 slot=0-1
rank 1=+n1 slot=0-1
在我看来,这应该将每个程序实例限制为它运行的本地计算机的核心0和1。 我像这样执行mpirun:
mpirun -np 2 -N 1 -rf /my/rank/file my_program
但是mpirun在没有执行我的程序的情况下失败并出现此错误:
Conflicting directives for mapping policy are causing the policy
to be redefined:
New policy: RANK_FILE
Prior policy: UNKNOWN
Please check that only one policy is defined.
这是什么?我在rankfile中犯了错误吗?
答案 0 :(得分:0)
不使用rankfile,只需使用hostfile:
n0 slots=n max_slots=n
n1 slots=n max_slots=n
然后告诉Open MPI使用以下方法为每个节点映射一个进程,每个进程有两个核心:
mpiexec --hostfile hostfile --map-by ppr:1:node:PE=2 --bind-to core ...
ppr:1:node:PE=2
读作:每个资源1 进程;资源类型是节点;每个进程2个处理元素。您可以通过添加--report-bindings
选项来检查实际绑定。