gpt4 book ai didi

python - OpenMPI : Permission denied error while trying to use mpirun

转载 作者:行者123 更新时间:2023-11-28 18:32:15 25 4
gpt4 key购买 nike

我想借助以下代码在不同的 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))

.

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

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 通过使用 gcloud 从每个实例登录到每个实例来自动设置我的所有 ssh key
  • 实例类型:n1-standard-1
  • 实例操作系统:Linux Debian(默认)

.

感谢您的帮助:-)

.

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

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

命令:

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

.

错误信息:

Host key verification failed.

.

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

那么,有人知道问题出在哪里吗?我还检查了路径、防火墙规则以及我在临时文件夹中编写启动脚本的能力。有人可以尝试重现这个问题吗? + 我应该向 Google 提出这个问题吗? (以前从未做过这样的事情,我很不确定:S)

感谢您的帮助:)

最佳答案

所以我终于找到了解决办法。哇,问题快把我逼疯了。

事实证明,我需要手动生成 ssh-keys 才能使脚本运行。我不知道为什么,因为谷歌服务已经通过使用设置了 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"

关于python - OpenMPI : Permission denied error while trying to use mpirun,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35819556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com