1

我正在尝试使用 KVM 在虚拟集群上运行 MPI。通过终端运行时,我的 OpenMPI 代码运行良好:

mpiuser@niru:~$ mpirun -n 5 -hostfile /home/mpiuser/hosts /home/mpiuser/hello

但是,当我运行我的 python 脚本时,使用

$sudo python test.py 

测试.py:

import subprocess
p=subprocess.Popen(['mpirun -n 5 -hostfile /home/mpiuser/hosts /home/mpiuser/hello'],shell=True)

我得到错误:

 ssh: connect to host test0 port 22: No route to host
ssh: connect to host test1 port 22: No route to host
--------------------------------------------------------------------------
A daemon (pid 6608) died unexpectedly with status 255 while attempting
to launch so we are aborting.

There may be more information reported by the environment (see above).

This may be because the daemon was unable to find all the needed shared
libraries on the remote node. You may set your LD_LIBRARY_PATH to have the
location of the shared libraries on the remote nodes and this will
automatically be forwarded to the remote nodes.

所以我尝试使用 shell 脚本运行命令,但我得到了同样的错误。

sudo sh ./launch.sh

启动.sh:

 mpirun -n 5 -hostfile /home/mpiuser/hosts /home/mpiuser/hello

我还尝试在我的计算机上导出 LD_LIBRARY_PATH :

  export LD_LIBRARY_PATH=/usr/lib/openmpi/lib/openmpi

为什么 mpirun 在命令行中工作而不是通过 Python 或 Shell 脚本工作?请帮忙!


更新:我的 ~/.ssh/config 文件的内容是:

Host test0 
Hostname 192.168.122.98
User mpiuser
PubKeyAuthentication yes
IdentityFile /home/mpiuser/cloudKey

Host test1
Hostname 192.168.122.195
User mpiuser
PubKeyAuthentication yes
IdentityFile /home/mpiuser/cloudKey
4

0 回答 0