linux - 如何自动设置 SSH key 的密码以在集群中运行 MPI 程序?

标签 linux ssh mpi ssh-keys mpich

我在一个有 4 个节点的 linux 集群 (n1.a.com, n2.a.com, n3.a.com, n4.a.com) logged in node 1 (n1.a.com)

现在我有一个名为“sample.out”的可执行文件,我想从节点 1 在集群上运行它。

我用密码设置了SSH key

我在“hosts.txt”中也有主机列表文件

n1.a.com:8
n2.a.com:8
n3.a.com:8
n4.a.com:8

所以,我正在运行以下命令:

mpiexec -n 32 -f hosts.txt ./sample.out

但是,运行上面的命令,所有其他 3 个节点都要求同时输入密码作为

 Enter passphrase for key '/home/a/.ssh/id_dsa': Enter passphrase for key
 '/home/a/.ssh/id_dsa': Enter passphrase for key '/home/a/.ssh/id_dsa':

现在在此处输入密码无效!它在输入密码时反复询问同样的事情。

我的查询

  1. 有没有办法自动将密码短语传递给所有 节点? (可能通过脚本)
  2. 或者,我是否必须使用无密码 key ?
  3. 有什么方法可以通过使用同样安装的“Torque Batch”管理器来避免这种情况

一些可能对我的系统有用的信息:

Workload Manager :- Torque Batch System

>>mpich2 --version
HYDRA build details:
    Version:                                 1.4.1p1
    Release Date:                            Thu Sep  1 13:53:02 CDT 2011
    Process Manager:                         pmi
    Launchers available:                      ssh rsh fork slurm ll lsf sge manual persist
    Topology libraries available:              hwloc plpa
    Resource management kernels available:    user slurm ll lsf sge pbs
    Checkpointing libraries available:
    Demux engines available:                  poll select

最佳答案

为了避免输入密码,需要创建一个 ssh-agent 并添加密码,如下所示:

ssh-agent $SHELL 
ssh-add 

来源:MPICH 1 Documentation: Configuring with ssh

关于linux - 如何自动设置 SSH key 的密码以在集群中运行 MPI 程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33969617/

相关文章:

c++ - MPI + OpenMP 段错误和不可预测的行为

c++ - linux下Qt,如何检测一个进程是否已经运行?

linux - 从崩溃信息中打印函数名称

java - 使用 SSHJ 时进行 Sudo 访问

windows - 在 Windows 上通过 ssh 连接到 mercurial

捕获信号 11(段错误 : address not mapped to object at address (nil))

c++ - MPI_Scatter 段错误

linux - Apache HTTP 服务器在哪里存储传入请求的数据

c++ - 我可以使用什么 C++ 库来检查 Linux 上的磁盘配额?

git - 如何在 IntelliJ IDEA 中存储 SSH 主机 key