MPIRun MPD mpiexec

Source: Internet
Author: User
Tags chmod ssh port number in python
Original Address:MPIRun MPD mpiexec Author:The foliage is flying 2. Install the configuration file and set it up
Run command 1:touch mpd.conf
Run command 2:chmod mpd.conf
Enter the following text content in the mpd.conf file and save:
Mpd_secretword=mr.chen

3. Open MPI server and compile and execute MPI files
3.1 Open MPI Environment: Mpdboot
3.2 To compile the MPI file (-o Hello Specify the name of the output file): Mpicc-o Hello hello.c
3.3 Executing the generated binaries (-NP 4: Representing 4 processes): MPIRUN-NP 4./hello
The results of the operation are as follows:
user@ubuntu:~/test_mpi_examples$ MPIRUN-NP 4/hello
Hello world! Processor 0 of 4 on Ubuntu
Hello world! Processor 1 of 4 on Ubuntu
Hello world! Processor 3 of 4 on Ubuntu
Hello world! Processor 2 of 4 on Ubuntu

4. Turn off MPI server
Run command: Mpdcleanup


6 Modifying the PATH environment variable

Path= "$PATH:/usr/local/mpich/bin"

7 Test environment variable settings

#which MPD

#which MPICC

#which mpiexec

#which MPIRun

All of the above commands should point to the bin subdirectory of the installation directory. In addition, if you do not share the installation directory with NFS, you will need to copy the bin subdirectory to each of the other machines.

8 Modify/etc/mpd.conf file, content is Secretword=myword

#vi/etc/mpd.conf

Set file Read permission only if you can read and write

#chmod 600/etc/mpd.conf

Non-root users create the same content in the home directory. mpd.conf

9 Create Host name collection file/root/mpd.hosts

#vi mpd.hosts

The contents of the document are as follows:

Station1

Station3

Station6

Station8

Use

MPICH2 uses MPD services to manage processes, using MPIEXEC to run MPI programs.

Mpd

Start the MPD service on a stand-alone machine

# MPD &

View MPD Services

# Mpdtrace View Host Name

Or

#mpdtrace –l View host name and port number

Turn off MPD process management

#mpdallexit

Start the MPD service on the cluster

# mpdboot–n Process-num–f mpd.hosts

Start Process-num process, mpd.hosts is the file created earlier.

MPICH2 The default is to use SSH to log in to the other machines in the cluster, or you can use RSH to log in to other machines in the cluster to start the MPD service.

Just use the-rsh option to specify SSH or rsh

#mpdboot-rsh=rsh–n process-num–f Hostfile

or #mpdboot-rsh=ssh–n process-num–f hostfile

Turn off the MPD service

#mpdallexit

Mpiexec

Using Mpiexec to perform MPI tasks

#mpiexec –NP 3/CPI

or Mpiexec–machinefile FILENAME–NP 4/cpi




1, MPICH2 1.0.3 The reason for the emergence of MPD such things, Mpich developers claimed that this is the MPI program communication and computing separate. In MPICH1, we directly use MPIRun to carry out a task, at this time, to use rsh these things to communicate, and then start the process, error debugging, the speed of the program to start and so have an impact. So, in MPICH2, this part of the communication is done alone, and that is MPD, and written in Python, easy to understand, to solve the problem above.

2, MPICH2 recommended to use mpiexec to perform tasks rather than mpirun, because indeed, mpiexec compared to MPIRun, there are a lot of practical feature, such as:

Mpiexec-n 1-host Loginnode Master:-n 32-host SMP slave

Mpiexec can do different task publishing strategies for different nodes. As you can see, we're going to publish a process on the loginnode that is master and publishes 32 processes on a machine called SMP (it's clear that this hostname is a 32 CPU machine). It's OK to separate the parameters with a colon.

3, through the above example, you can see that mpiexec can do a lot of customization for the node. such as-N,-path,-wdir,-host,-file,-configfile These parameters are commonly used, such as-wdir can be customized working directory. Also, Mpiexec supports the customization of environment variables, which is very practical, that is, you can define different environment variable lists for different processes. Like this example:

Mpiexec-n 1-env FOO BAR a.out:-N 2-env bazz fazz b.out

As you can see, we have defined an environment variable (value bar) for A.out, which defines a bazz for b.out

Mpiexec-genv FOO bar-n 2 a.out:-N 4 b.out

With genv (global env), you can have this environment variable take effect in all processes.

Using-envall,-genvall These two option to publish the list of environment variables on the machine where the program is executing mpiexec to the specified process (all processes).

With-envnone,-genvnone can empty the environment variables for the specified process (all processes). This allows us to define a clean list of environment variables, such as:

Mpiexec-genvnone-env FOO bar-n a.out

Thus, the environment variable for the a.out process has only one environment variable of foo.

Mpiexec-genvnone-envlist path,ld_search_path-n a.out

This example shows that the path on the mpiexec's machine, ld_search_path these two environment variables, is published to the a.out process, and the other environment variables are emptied.

This thing is still very useful, especially ld_library_path this environment variable, it is likely to be based on different processes to customize.


  4, Mpiexec also has many practical options, such as:

-l:provides rank labels for lines of stdout and stderr.

is good for debugging, because in stdout and stderr information, you can see which process print the information. The

-machinefile:

Mpiexec in Machinefile is a bit enhanced than machinefile in MPICH1, and here's an example:

# comment Line
H Osta
Hostb:2
hostc ifhn=hostc-gige
hostd:4 ifhn=hostd-gige

can see that not only can you define machine, you can also define what network interface to use for multiple network The cluster of paragraph is good. When mpiexec publish a task, it will be published one at a time according to this list.

-s:can be used to direct the stdin of mpiexec to specific processes in a parallel job.

This is also a useful option. This option allows us to do input on the machine executing mpiexec, and then it is useful to send these inputs to the specified process.

Mpiexec-s all-n 5 a.out # Passes input to all processes

Mpiexec-s 4-n 5 a.out # Input to the process of rank 4

Mpiexec-s 1, 3-n 5 A.out # passed to 1,3 process

Mpiexec-s 0-3-N 5 a.out #传给0, 1, 2, 3 process

MPD offers other more practical commands, such as mpdsigjob, which let us signal the process, which is much better than the one we used to terminate a process in MPICH1, which is a lot better than CTRL + C, which is the benefit of making the communication a separate module. Now we can use Mpdsigjob to release the specified signal for one or a batch of processes, such as SIGINT is the equivalent of CTRL + C.

5, MPICH2 support with GDB debugging parallel programs. But do not know how to support, you can see this example in User guide, you can see that in the GdB debugging process, will show the current execution of the code will be executed in which processes. Also, by using the z command, you can go to the specified individual process for debugging. Setting breakpoints, stepping is also availalable.

6, finally is some FAQ, here extracts some valuable:

(1) What is the difference between MPD & SMPD process Manager?

MPD is the default process manager for MPICH2 on Unix platforms. It is written in Python. SMPD is the primary process manager for MPICH2 on Windows. It is also used to running on a combination of Windows and Linux machines. It is written in C.

(2) When I use the g95 Fortran compiler on a 64-bit platform some of the tests

A:The g95 Compiler incorrectly defines the default Fortran integer as a 64-bit integer while defining Fortran reals as 32 -bit VALUES (the Fortran standard requires that INTEGER and real is the same size). This is apparently done to allow a Fortran to hold the value of a pointer rather than requiring the programmer T o Select an INTEGER of a suitable KIND. To force the G95 compiler to correctly implement the Fortran standard, use THE-I4 flag. For example, set the environment variable f90flags before configuring MPICH2:

setenv f90flags "-i4"

G95 users should note that there (at this writing) are two distributions to g95 for 64-bit Linux platforms. One uses 32-bit integers and reals (and conforms to the Fortran standard) and one uses 32-bit and integers 64-bit. We recommend using the "one" conforms to the standard (note this standard specifies the ratio of sizes, not the ABS Olute sizes, so a Fortran compiler that used of bits for both integers and real would also conform to the Fortran Standa Rd. However, such a compiler would need to use 128 bits for DOUBLE PRECISION quantities).

(3) q:how do I pass environment variables to the processes of my parallel program when using the MPD process Manager?

A:by default, all the environment variables in the shell where Mpiexec are run are passed to all processes of the Applicat Ion program. (The one exception is LD LIBRARY PATH the MPD ' s are being run as root.) This default can is overridden in many ways, and individual environment variables can is passed to specific processes g arguments to Mpiexec.

Note that, as mentioned above, mpiexec can customize the environment variable, but here's the exception to Ld_library_path in the MPD ring, which is started by root.

Related Keywords:

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.