1. mpich2 1.0.3 indicates that MPD is used to separate communication and computing of MPI programs. In mpich1, we directly use mpirun to execute a task. At this time, we need to first use rsh to communicate with each other and then start the process, which affects error debugging and program startup speed. Therefore, in mpich2, the communication part is made separately, that is, MPD, and written in Python, which is easy to understand, so as to solve the above problem.
2. mpiexec is recommended for mpich2 to execute tasks instead of mpirun, because indeed, compared with mpirun, mpiexec has a lot of practical feature, such:
Mpiexec-N 1-host loginnode master:-N 32-host SMP slave
Mpiexec can implement different task release policies for different nodes. The preceding command shows that we want to publish a process on loginnode. the executable file of this process is the master, and 32 processes are published on a machine named SMP (obviously, this host named SMP is a machine with 32 CPUs ). It is OK to separate different parameters with commas.
3. Through the above example, we can see that mpiexec can be customized for nodes. For example, parameters such as-N,-path,-wdir,-host,-file, and-configfile are commonly used. For example,-wdir can be used to customize working directory. In addition, mpiexec also supports environment variable customization, which is very practical. That is, you can define different environment variable lists for different processes. For example:
Mpiexec-N 1-env Foo bar a. Out:-N 2-env bazz Fazz B. Out
We can see that we have defined a foo environment variable for A. Out (the value is bar) and a bazz for B. Out.
Mpiexec-genv Foo bar-N 2 A. Out:-N 4 B. Out
With genv (Global env), this environment variable can take effect in all processes.
Use the-envall and-genvall options to publish the list of environment variables on the machine on which the program runs mpiexec to the specified process (all processes ).
-Envnone and-genvnone can be used to clear the environment variables of the specified process (all processes. This allows us to define a clean list of environment variables, such:
Mpiexec-genvnone-env Foo bar-N 50 A. Out
In this way, the environment variable of the. Out process has only one Foo environment variable.
Mpiexec-genvnone-envlist path, ld_search_path-N 50 A. Out
This example shows that the two environment variables path and ld_search_path on the machine where mpiexec is located are published to the. Out process, and other environment variables are cleared.
This is useful, especially the environment variable LD_LIBRARY_PATH, which may be customized according to different processes.
4. mpiexec has many practical options, such:
-L: Provides rank labels for lines of stdout and stderr.
This is very helpful for debugging, because in the stdout and stderr information, we can see which process prints this information.
-Machinefile:
The machinefile in mpiexec is a little enhanced than the machinefile in mpich1. Here is an example:
# Comment line
Hosta
Hostb: 2
Hostc ifhn = hostc-gige
Hostd: 4 ifhn = hostd-gige
We can see that not only the machine can be defined, but also the network interface used. This is good for the cluster of multiple network segments. Mpiexec publishes a task one by one based on the list.
-S: can be used to direct the stdin of mpiexec to specific processes in a parallel job.
This is also a very practical option. This option can be used for input on the machine where mpiexec is executed, and then the input is sent to the specified process.
Mpiexec-s all-N 5 A. Out # pass the input to all processes
Mpiexec-S 4-N 5 A. Out # input to the process whose rank is 4
Mpiexec-S 1, 3-N 5 A. Out # Pass to 1, 3 Process
Mpiexec-S 0-3-N 5 A. Out # to 0, 1, 2, 3 Process
MPD provides some other useful commands, such as mpdsigjob. This command allows us to issue signal to the process, which is better than when we used to terminate a process in mpich1, pressing CTRL + C is much better. This is the benefit of making communication into a single module. Now we can use mpdsigjob to publish the specified signal to one or more processes. For example, SIGINT is equivalent to Ctrl + C.
5. mpich2 supports debugging parallel programs with GDB. But I don't know how it is supported. You can see this example in the user guide. You can see in the gdb debugging process, it shows the processes in which the code is being executed. In addition, you can use the Z command to access a specified single process for debugging. Both breakpoint setting and single-step execution are availalable.
6. There are some FAQs. Here we will extract some valuable ones:
(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 for 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 fail
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 be the same size ). this was apparently done to allow a FORTRAN integer to hold the value of a pointer, rather than requiring the programmer to 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 processing ing mpich2:
Setenv f90flags "-I4"
G95 users shocould note that there (at this writing) are two distributions of g95 for 64-bit Linux platforms. one uses 32-bit integers and reals (and conforms to the Fortran standard) and one uses 32-bit integers and 64-bit reals. we recommend using the one that conforms to the standard (note that the Standard specifies the ratio of sizes, not the absolute sizes, so a Fortran 95 compiler that used 64 bits for both integer and real wowould also conform to the Fortran standard. however, such a compiler wowould 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 is run are passed to all processes of the application program. (The one exception is ld library path when the MPD's are being run as root .) this default can be overridden in always ways, and individual environment variables can be passed to specific processes using arguments to mpiexec.
Note: As mentioned above, mpiexec can be used to customize environment variables, but as mentioned here, LD_LIBRARY_PATH has exceptions in the root-enabled MPD ring.