1) 设置ssh免密登录
[root@node1 ~]# ssh-keygen -N ''
[root@node1 ~]# ssh-copy-id root@node1.1000cc.net
[root@node1 ~]# ssh-copy-id root@node2.1000cc.net
[root@node1 ~]# ssh-copy-id root@node3.1000cc.net
2) 安装mpich
[root@node1 ~]# wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz
[root@node1 ~]# pscp.pssh -h host-list.txt ./mpich-3.3.2.tar.gz ~
[1] 18:04:07 [SUCCESS] root@node2.1000cc.net
[3] 18:04:07 [SUCCESS] root@node3.1000cc.net
[root@node1 ~]# pssh -h host-list.txt -i 'tar xvfz mpich-3.3.2.tar.gz'
[root@node1 ~]# pssh -h host-list.txt 'yum install gcc gcc-gfortran gcc-c++ -y
[1] 18:06:22 [SUCCESS] root@node1.1000cc.net
[2] 18:06:40 [SUCCESS] root@node2.1000cc.net
[3] 18:06:40 [SUCCESS] root@node3.1000cc.net
# 为所有主机[node1,node2,node3]安装mpich
[root@node1 ~]# cd mpich-3.3.2
[root@node1 mpich-3.3.2]# ./configure && make && make install
[root@node2 ~]# cd mpich-3.3.2
[root@node2 mpich-3.3.2]# ./configure && make && make install
[root@node3 ~]# cd mpich-3.3.2
[root@node3 mpich-3.3.2]# ./configure && make && make install
3) 确认mpich安装完成
[root@node1 ~]# mpiexec -version
HYDRA build details:
Version: 3.3.2
Release Date: Tue Nov 12 21:23:16 CST 2019
CC: gcc -std=gnu99
CXX: g++
F77: gfortran
F90: gfortran
Configure options: '--disable-option-checking' '--prefix=NONE' '--cache-file=/dev/null' '--srcdir=.' 'CC=gcc -std=gnu99' 'CFLAGS= -O2' 'LDFLAGS=' 'LIBS=' 'CPPFLAGS= -I/root/mpich-3.3.2/src/mpl/include -I/root/mpich-3.3.2/src/mpl/include -I/root/mpich-3.3.2/src/openpa/src -I/root/mpich-3.3.2/src/openpa/src -D_REENTRANT -I/root/mpich-3.3.2/src/mpi/romio/include' 'MPLLIBNAME=mpl'
Process Manager: pmi
Launchers available: ssh rsh fork slurm ll lsf sge manual persist
Topology libraries available: hwloc
Resource management kernels available: user slurm ll lsf sge pbs cobalt
Checkpointing libraries available:
Demux engines available: poll select
4) 测试mpich HPC集群
[root@node1 ~]# vim host.lst
node2.1000cc.net
node3.1000cc.net
# 定义计算处理为6次,计算节点为machinefile所指定文件中包含的主机
[root@node1 ~]# mpiexec -n 6 -machinefile ~/host.lst ~/mpich-3.3.2/examples/cpi
no sessions
open terminal failed: not a terminal
no sessions
open terminal failed: not a terminal
Process 2 of 6 is on node2.1000cc.net
Process 4 of 6 is on node2.1000cc.net
Process 1 of 6 is on node3.1000cc.net
Process 5 of 6 is on node3.1000cc.net
Process 0 of 6 is on node2.1000cc.net
Process 3 of 6 is on node3.1000cc.net
pi is approximately 3.1415926544231243, Error is 0.0000000008333312
wall clock time = 0.020401
|