OpenMPI:尝试使用mpirun

时间:2016-03-05 20:33:22

标签: python ssh mpi google-compute-engine permission-denied

我希望借助以下代码在不同的Google云计算实例上通过MPI显示“hello world”:

from mpi4py import MPI

size = MPI.COMM_WORLD.Get_size()
rank = MPI.COMM_WORLD.Get_rank()
name = MPI.Get_processor_name()

print("Hello, World! I am process/rank {} of {} on {}.\n".format(rank, size, name))    

问题是,即便如此,我可以毫无问题地连接所有这些实例,当我尝试运行我的脚本时,我收到一条权限被拒绝的错误消息。我使用以下命令来调用我的脚本:

  

mpirun --host localhost,instance_1,instance_2 python hello_world.py

并收到以下错误消息:

Permission denied (publickey).
--------------------------------------------------------------------------
ORTE was unable to reliably start one or more daemons.
This usually is caused by:

* not finding the required libraries and/or binaries on
  one or more nodes. Please check your PATH and LD_LIBRARY_PATH
  settings, or configure OMPI with --enable-orterun-prefix-by-default

* lack of authority to execute on one or more specified nodes.
  Please verify your allocation and authorities.

* the inability to write startup files into /tmp (--tmpdir/orte_tmpdir_base).
  Please check with your sys admin to determine the correct location to use.

*  compilation of the orted with dynamic libraries when static are required
  (e.g., on Cray). Please check your configure cmd line and consider using
  one of the contrib/platform definitions for your system type.

* an inability to create a connection back to mpirun due to a
  lack of common network interfaces and/or no route found between
  them. Please check network connectivity (including firewalls
  and network routing requirements).
--------------------------------------------------------------------------

其他信息:

  • 我在所有节点上安装了open-MPI
  • 我让Google自动设置我的所有ssh-key,方法是使用gcloud从每个实例登录每个实例
  • instance-type:n1-standard-1
  • instance-OS:Linux Debian(默认)

感谢您的帮助: - )

新信息:
(感谢@ Zulan指出我应该编辑我以前的帖子而不是为新信息创建新答案)

所以,我尝试用mpich而不是openmpi做同样的事情。但是,我遇到了类似的错误消息。

命令:

  

mpirun --host localhost,instance_1,instance_2 python hello_world.py

错误讯息:

Host key verification failed.

我可以毫无问题地连接我的两个实例,并且通过gcloud命令可以自动正确设置ssh-keys。

那么,有人知道问题可能是什么吗?我还检查了路径,防火墙规则以及我在temp-folder中编写启动脚本的能力。有人可以尝试重新创建这个问题吗? +我应该向谷歌提出这个问题吗? (从来没有做过这样的事情,我很不确定:S)

感谢您提供帮助:)

1 个答案:

答案 0 :(得分:1)

所以我终于找到了解决方案。哇,问题让我疯了。

事实证明,我需要手动生成ssh-key才能使脚本正常工作。我不明白为什么,因为谷歌服务已经通过使用设置了密钥 gcloud compute ssh,但是,它有效:)

我做的步骤:

instance_1 $ ssh-keygen -t rsa
instance_1 $ cd .ssh
instance_1 $ cat id_rsa.pub >> authorized_keys
instance_1 $ gcloud compute copy-files id_rsa.pub 
instance_1 $ gcloud compute ssh instance_2

instance_2 $ cd .ssh
instance_2 $ cat id_rsa.pub >> authorized_keys

我将打开另一个主题并询问为什么我不能使用ssh instance_2,即使如此gcloud compute ssh instance_2正在运作。请参阅:Difference between the commands "gcloud compute ssh" and "ssh"