RedHat + MPI + SSH scientific cluster Installation Guide

Source: Internet
Author: User
1. System Configuration CPU --- AMDathlon1G; AMDathlon1.1GRAM --- SDRAM768M; DDR256MOS --- RedHatlinux7.3, 2.4.18MPI --- mpich1.2.4, done

1. System Configuration
CPU --- AMD athlon 1G; AMD athlon 1.1G
RAM --- SDRAM 768 M; DDR 256 M
OS --- RedHat linux 7.3, 2.4.18
MPI --- mpich 1.2.4, http://www-unix.mcs.anl.gov/mpi/mpichsource code download
Network --- 100 M realtek8139, M Switch

2. linux Installation
The installation process is not detailed. The only thing you need to note is to select SSH as a trusted service during installation. After installation, ensure that each node can log on to each other using ssh. Each node's sshd should be able to provide services normally. Redhat 7. x implements access control over each port in ipchains, rather than using tcp-wrapper hosts. allow and hosts. deny file for control. If you cannot log on to other machines by Using ssh after installing the system, you can run the ipchains-L command to view ipchains rules and perform the correct configuration to make the ssh service work properly. If you do not care too much about system security, you can use the ipchains-F command to clear all rules.

Host Name: shallow sea
● Modify the/etc/hosts file and fill in the names and IP addresses of all nodes. For example:
211.64.128.129 shallow
211.64.128.217 sea
Similar configurations are performed on each node. In this way, nodes can access each other by using the shallow and sea names. You can ping noden or ssh noden for testing.

● Modify (or create) the/etc/hosts. equiv file
Enter the names of all the machines that you allow access to the local machine for mpi computing, with one machine name in one row. This step is used to grant permissions to other nodes.
For example, the/etc/hosts. equiv file of my machine shallow is as follows:
Shallow # grant permissions to yourself so that you can simulate a parallel computing environment when there is only one machine.
Sea

In the/etc/hosts. equiv file of sea:
Shallow # authorize shallow
Sea

● Use nfs shared files
First, a user name used to start cluster computing is determined. root is not recommended for cluster computing. Here, create a new user mpi at each node. Their main directories are/home/mpi. Assume that we use sea as the computing service node and create ~ /Mirror, modify the file/etc/exports, and add a line in it:/home/mpi/mirror shallow (rw) sea (rw) this allows users of shallow and sea machines to use/home/mpi/mirror. Create/home/mpi/mirror on other nodes and add a line in the/etc/fstab file: sea:/home/mpi/mirror nfs rw, the node shallow such as bg and soft 0 can use mirror to share files with sea.

● Modify ~ /. Bash_profile File
It is recommended to place the computing program in the same path in the future. Of course, it may not be placed in the same directory, but it is more troublesome to use. You need to specify the path of each node program one by one. For example, if your program is fpi. f and a. out, put a. out in ~ /Mpi/mirror. Modify ~ The/. bash_profile file mainly includes the following scripts:
Export PATH = $ PATH:/usr/local/mpich/bin
Export MPI_USEP4SSPORT = yes
Export MPI_P4SSPORT = 22
Export P4_RSHCOMMAND = ssh
Here, we plan to install the runtime environment of mpich in the/usr/local/mpich directory in the future. The other three variables are used to notify the mpi runtime environment to use ssh as a remote shell.

Now the linux operating environment is configured.

3. Configure ssh
Run ssh-keygen-t dsa (SSH2) or ssh-keygen (SSH1)-t rsa1, this generates a private/public key pair, which is stored in ~ /. Ssh/id_dsa and ~ /. Ssh/id_dsa.pub or ~ /. Ssh/identity and ~ /. Ssh/identity. pub file. Then perform Access Authorization and run:
Cp ~ /. Ssh/identity. pub ~ /. Ssh/authorized_keys
Or cp ~ // Ssh/id-dsa.pub ~ /. Ssh/authorized_keys2
Chmod go-rwx ~ /. Ssh/authorized_keys
Or chmod go-rwx ~ /. Ssh/authorized_keys2
Ssh-agent $ SHELL
Ssh-add
Perform this operation on each node.
Collect the keys authorized_keys or authorized_keys2 of all nodes, put them in a key file, and distribute them to each node. In this way, no password is required for each node to access each other. Log on to another node on each node. For ssh shallow ~ /. Ssh/generates a known_hosts file, which records the logon User Key.

4. Download, compile, and install mpich 1.2.3
Download the latest mpich 1.2.4:

Ftp://ftp.mcs.anl.gov/pub/mpi/mpich.tar.gz. Copy it to a temporary directory and put it in/home/mpi/mirror. First, use tar xvfz mpich.tar.gz to decompress the package. Generate a mpich-1.2.4 directory. Switch to the mpich-1.2.4 directory.
Run preprocessing:./configure-c ++ = pgCC-cc = pgcc-fc = pgf77-f90 = pgf90
-Cflags = "-Msignextend-tp athlon-DUSE_U_INT_FOR_XDR-DHAVE_RPC_RPC_H = 1"
-Fflags = "-tp athlon"-c ++ flags = "-tp athlon"-f90flags = "-tp athlon"
-Prefix =/usr/local/mpich-opt =-fast-rsh = ssh
I use the Portland Group compiler, so we need to specify the compiler used and common options during preprocessing.-tp athlon generates code for AMD athlon. The installation location of mpich is/usr/local/mpich, and the remote shell of the runtime environment is ssh. -DUSE_U_INT_FOR_XDR-DHAVE_RPC_RPC_H = 1 you do not need to set environment variables on some systems:
Setenv LIBS "-L/usr/local/pgi/linux86/lib-lpgftnrtl-lpgc"

Compile: make
Install: make install

Modify/usr/local/mpich/share/util/machines. LINUX. Specify the nodes that can be used for Cluster Computing. What I see is:
Shallow
Sea
If it is a multi-CPU computer, use num after the node name.
Each node does this again.

5. Test parallel computing
Log on to the set user (my mpi) sea and copy the mpich1.2.4/examples/basic/fpi. f file ~ In/mpi/mirror, compile:
Mpif77 fpi. f, generate the. out file, and run:
Mpirun-np 2 a. out
Two nodes are used for calculation. After an ssh connection is established, the program waits for input. You can run the following command on the node:
Ps-A | grep aout
You can view several fpi processes. The first one is the process executed by the local machine, and the other is the remote process image. Enter an integer on the sea and execute it on each node again.
Ps-A | grep a. out
It can be found that the computing time is growing, indicating that the computing is indeed performed on multiple hosts at the same time. At this point, the entire installation and configuration process is complete. If you have any problems, you can refer to the mpich manual to solve them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.