OpenMPI:尝试使用 mpirun 时出现权限被拒绝错误
OpenMPI: Permission denied error while trying to use mpirun
我想借助以下代码在不同的 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 密钥
- 实例类型:n1-standard-1
- 实例-OS:Linux Debian(默认)
.
感谢您的帮助:-)
.
新信息:
(感谢@Zulan 指出我应该编辑我以前的 post 而不是为新信息创建新答案)
所以,我尝试用 mpich 而不是 openmpi 做同样的事情。但是,我运行进入了类似的错误信息。
命令:
mpirun --host localhost,instance_1,instance_2 python hello_world.py
.
错误信息:
Host key verification failed.
.
我可以毫无问题地在我的两个实例之间进行 ssh 连接,并且通过 gcloud 命令,ssh-keys 应该会自动正确设置。
那么,有人知道问题出在哪里吗?我还检查了路径、防火墙规则以及我在临时文件夹中编写启动脚本的能力。有人可以尝试重现这个问题吗? + 我应该向 Google 提出这个问题吗? (以前从来没有做过这样的事情,我很不确定:S)
感谢帮助:)
所以我终于找到了解决办法。哇,问题快把我逼疯了。
事实证明,我需要手动生成 ssh 密钥才能使脚本运行。我不知道为什么,因为 google-services 已经通过使用设置了密钥
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
是有效的。参见:
我想借助以下代码在不同的 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 密钥
- 实例类型:n1-standard-1
- 实例-OS:Linux Debian(默认)
.
感谢您的帮助:-)
.
新信息:
(感谢@Zulan 指出我应该编辑我以前的 post 而不是为新信息创建新答案)
所以,我尝试用 mpich 而不是 openmpi 做同样的事情。但是,我运行进入了类似的错误信息。
命令:
mpirun --host localhost,instance_1,instance_2 python hello_world.py
.
错误信息:
Host key verification failed.
.
我可以毫无问题地在我的两个实例之间进行 ssh 连接,并且通过 gcloud 命令,ssh-keys 应该会自动正确设置。
那么,有人知道问题出在哪里吗?我还检查了路径、防火墙规则以及我在临时文件夹中编写启动脚本的能力。有人可以尝试重现这个问题吗? + 我应该向 Google 提出这个问题吗? (以前从来没有做过这样的事情,我很不确定:S)
感谢帮助:)
所以我终于找到了解决办法。哇,问题快把我逼疯了。
事实证明,我需要手动生成 ssh 密钥才能使脚本运行。我不知道为什么,因为 google-services 已经通过使用设置了密钥
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
是有效的。参见: