1. Under the/etc/sysconfig/network-scripts/ifcfg-eth0 file, you can configure the eth0 Nic Parameters
Ipaddr = IP Address
Netmask = Subnet Mask
Network = Local Area Network
Broadcast = broadcast address
Bootproto = obtain the address (static -- static IP, DHCP -- Dynamic IP)
2. Configure NFS
1) write the/etc/exports file
[Directory to be shared] [accessible host name, IP address, or wildcard combination] (RW | ro)
....
....
More detailed format description of this file in http://blog.chinaunix.net/u/26040/showart_285389.html
I tried to fill in 192.168.1. * (RW) but cannot access it. The error message is permission denied. It may be because the brackets are connected with the asterisks. After changing to the host name, there will be no problem.
2) Start the Portmap service and NFS service.
Service Portmap restart
Service NFS restart
3) Pay attention to the firewall. In addition to disabling or trusting NICs, you do not know how to configure the firewall to successfully Configure NFS. If you can ping the firewall, if no route to host error occurs, the firewall is faulty.
4) The client uses the mount command to mount the NFS public directory and does not need to add the public directory information to the fstab file of the client, can be mounted successfully (the client can detect the mounted directory using the DF command ).
3. Modify the network host name resolution in the/etc/hosts file
Can be written:
[IP] [host name]
You can also write it as follows:
[IP] [domain name] [host name]
I do not know the difference between the two, but they can be used normally.
4. Configure RSH for Logon without a password
Preparations
A) Check whether RSH and rsh-server have been installed on the logged-on host. Run the command rpm-AQ | grep ^ RSH * (for centos ). If not, install yum.
B) after installation, go to/etc/xinetd. d/to edit the rlogin, RSH, and rexec files, and change the original disable = yes to disable = No.
C) run the/etc/init. d/xinetd restart command.
Hosts. equiv file mode:
Create the hosts. equiv file in the/etc/directory on the logged-on host, and press
[Host Name H] [user name u]
After setting, the U user on the remote host h can log on to the local machine without a password. Of course, the IP resolution settings corresponding to H should be included in the/etc/hosts file.
The user name is optional. If this parameter is not set, all common users on host h can log on without a password.
For detailed format descriptions of the hosts. equiv file, http://www.ibeijie.cn/hosts-equiv-file-format-and-the-use-of here
The host to be logged on is configured. The allowed client host can be logged on without a password as long as the allowed user executes the RSH [logon host name or IP address.
5. Password-less SSH login configuration
In this configuration process, separate role host a and B, a -- client host, execute remote logon, and B -- server host, and be logged on.
1) Run ssh-keygen-t rsa on host a without any parameters. By default, a file is created in the current user's home directory. and generate an id_rsa and iid_rsa.pub file,. the record public key with the suffix pub, and the other record private key. Note that during the generation process, press enter directly for any input, so that you can use the default method. For more information, see the SSH professional configuration document.
2) copy the generated id_rsa.pub file in the. Ssh directory and change it to authorized_keys.
3) execute the command scp a:/home/username/. Ssh/authorized_keys ~ on host B ~ /. Ssh/. In this way, the public key file is copied to host B (other remote file transmission commands can also be used), but SCP does not need the public directory of the other party (such as NFS ). When using SCP, you may be asked if you want to establish a link (depending on whether the connection is established for the first time). Enter yes. Then, you must enter the password of host.
4) after host B obtains the public key file generated by host a (and is placed under the user of host B. in the SSH folder), you can use host a to log on to host B. The first time you need to enter the password, you will not need to use it. However, note that this process is irreversible. Host B cannot log on to host a without a password.
Ray Ren's anecdote: here, the. Ssh folder is created by calling the ssh-keygen command. Its property is drwx ------, and everything is fine. However, if you manually use mkdir to create drwxr-XR-X, the check of this folder will be skipped during Remote logon, even if there is an authorized_keys file in it.
6. install and configure mpich2
Configuration preparation:
1) NFS and NIS are both optional and can be used without any operations.
2) Configure SSH. For more information about SSH configuration, see 5th. However, after configuration in, host B cannot access host a without a password. To achieve this, copy the contents of the. Ssh folder in the user directory of host a to host B. After this is done, both A and B use the same key and have the same public key. In this case, the two hosts are equal and can access each other without a password. The same applies to more host clusters.
3) create the same user for each cluster host. Configure/etc/hosts to enable mutual resolution between hosts. This means that all hosts use a fixed IP address. When I succeed, there is no domain name. One machine is called node3, the other is called node4, and no domain is set. (Failed for a long time when setting the domain. I don't know if there is any reason)
4) Delete the parsing data of 127.0.0.1 in/etc/hosts of each host. This step is critical. If it is not deleted, the MPI cluster cannot be started later.
5) install the GCC compiler and the GCC-C ++ compiler. (The default configuration file of mpich2 must be g ++, but can be deleted. The specific procedure is unknown)
6) disable the firewall.
Installation Process:
1) First, Mpi must be installed on all cluster hosts. In other words, you do not need to install all of them. You only need to install one of them and use NFS to publish the directory to mount other hosts. (But I have never tried it. I cannot make a final conclusion)
2) The installation directory should be considered before installation, and the MPI installation directories of all cluster hosts must be consistent.
3) download the tar file of mpich2 and distribute it to each host by various means. (For example, I am a host for NFS)
4) there is no problem using the root account throughout the installation process. (Specifically)
5) decompress the tar file. The extracted file contains a configure executable file./configure -- prefix = installation directory. (It is strongly recommended to specify the installation directory. If this parameter is not specified, the installation directory will be set to/usr/local/share/by default)
6) After configure is executed, execute make and make installl accordingly.
7) the installation is complete and repeated on each host.
Single-host startup:
Before starting the cluster, start it on a single machine. Switch to the user who uses MPI. Generally, root is not supported. Then in the main folder of the directory:
1) touch. MPD. conf
2) chmod 600. MPD. conf
3) Use VI to add the following sentence: mpd_secretword = ABC. ABC is the password you want to use. Fill in other words. Because mpich2 requires security protection, you cannot skip this step to change the File Permission. If you do not have the permission, you cannot start the file.
4) modify the user's. bashrc file and add an export Path = mpich2 installation directory/bin: $ path. In this way, you can directly use the mpich2 command.
Everything is ready. Call MPD and start mpich2 in the background.
After mpich2 is started, make sure that mpich2 can work in a single machine. The share folder in the installation directory of mpich2 contains the examples_logging folder, which containsCodeIs the sample code, a parallel pI value calculationProgramCopy the home directory.
5) Call mpicc CPI. C-o CPI to compile the program.
6) Call mpiexec-NP 5./CPI to execute the program. The-NP parameter specifies the number of parallel cores. On a single machine, multi-process simulation is started.
After running the command correctly, start the cluster.
Cluster startup:
1) disable the MPD process on all hosts, if any. Run the mpdallexit command on each host.
2) Select a host as the startup host and create an MPD. Hosts file under the host.
Touch MPD. Hosts
Use the VI editor to write names of all hosts to be added to the cluster, including the current host (note)
3) In an optional step, use mpdcheck-f mpd. hosts-ssh to test whether all hosts can be accessed through SSH without a password.
4) run the mpdboot-N 3-f mpd. hosts command, where-N specifies the number of cores, generally less than or equal to the number of hosts in the host list file.
After the program is started, you can run the parallel program in standalone mode!
Troubleshooting:
1) Invalid Port info appears when mpdboot is executed. Generally, this error is caused by inconsistent installation directories of mpich2 on various hosts, and even some machines are not installed. But there are many other reasons.
2) one reason why mpdboot cannot be added to a node: the node has already been added to a parallel computer group, but it has not ended normally. As a result, the Logon account file used by mpich is stored in its/tmp directory, delete it.