1. Configure the environment (1) Configure/etc/hosts (root User) 202.117.10.37www.linuxidc.com (master node) 202.117.10.50www.linuxidc.net (slave node) on the two machines respectively (2
1. Configure the environment
(1) Configure/etc/hosts on the two machines respectively (root User)
202.117.10.37 www.linuxidc.com (master node)
202.117.10.50 www.linuxidc.net (slave node)
(2) create linuxidc users on the two machines respectively
(3) Configure NFS
Mount the/home directory on the master node www.linuxidc.com from www.linuxidc.net and set it to mount on startup
(4) Configure login without a password (use linuxidc user on www.linuxidc.com)
- Ssh-keygen-t rsa
- Cp ~ /. Ssh/id_rsa.pub ~ /. Ssh/authorized_keys
2. Install mpich2 (the linuxidc user is on the www.linuxidc.com node)
(0) Preparation
Create under/home/linuxidc
Program/mpich2-install directory
Softdirectory (set mpich2-1.4.1p1.tar.gz)
Study/mpi-study directory
(1) Extract
Tar-zxvf mpich2-1.4.1p1.tar.gz
(2) Installation
- ./Configure-prefix =/home/linuxidc/program/mpich2-install/
- Make
- Make install
(3) simple configuration
Linuxidc@www.linuxidc.com ~ $ Vi. bashrc
Export PATH =/home/linuxidc/program/mpich2-install/bin: $ PATH
Linuxidc@www.linuxidc.com ~ $ Source. bashrc
(4) Verification
- Linuxidc@www.linuxidc.com ~ $ Which mpicc
- ~ /Program/mpich2-install/bin/mpicc
- Linuxidc@www.linuxidc.com ~ $ Which mpiexec
- ~ /Program/mpich2-install/bin/mpiexec
3. Test
(1) machinefile // still use ip address. An error occurred while testing the instance with the machine name.
Linuxidc@www.linuxidc.com ~ $ Vi machinefile
- 202.117.10.37: 4
- 202.117.10.50: 2
(2) test
- Linuxidc@www.linuxidc.com ~ $ Mpiexec-f machinefile-n 6./soft/mpich2-1.4.1p1/examples/cpi
- Process 0 of 6 is on www.linuxidc.com
- Process 1 of 6 is on www.linuxidc.com
- Process 3 of 6 is on www.linuxidc.com
- Process 2 of 6 is on www.linuxidc.com
- Process 4 of 6 is on www.linuxidc.net
- Process 5 of 6 is on www.linuxidc.net
- Pi is approximately 3.1415926544231239, Error is 0.0000000008333307
- Wall clock time = 0.001708
4. Enhanced Configuration
(1) Add machinefile to the Environment Variable
Cp ~ /Machinefile ~ /Programs/mpich2-install/
Linuxidc@www.linuxidc.com mpich2-install $ vi ~ /. Bashrc
- Export MPI_USEP4SSPORT = yes
- Export MPI_P4SSPORT = 22
- Export P4_RSHCOMMAND = ssh
- Export PATH =/home/linuxidc/program/mpich2-install/bin: $ PATH
- Export HYDRA_HOST_FILE =/home/linuxidc/program/mpich2-install/machinefile
[Linuxidc@www.linuxidc.com mpich2-install] $ source ~ /. Bashrc
(2) test (that is, you do not need to declare machinefile in the command line. The default value is HYDRA_HOST_FILE in the environment variable)
- Linuxidc@www.linuxidc.com ~ $ Mpiexec-n 7./soft/mpich2-1.4.1p1/examples/cpi
- Process 1 of 6 is on www.linuxidc.com
- Process 2 of 6 is on www.linuxidc.com
- Process 3 of 6 is on www.linuxidc.com
- Process 0 of 6 is on www.linuxidc.com
- Process 4 of 6 is on www.linuxidc.net
- Process 5 of 6 is on www.linuxidc.net
- Pi is approximately 3.1415926544231239, Error is 0.0000000008333307
- Wall clock time = 0.001440