How to Run MPICH-2 Programs Interactively
There are 3 commands necessary to run MPICH-2
programs
- mpdboot - boot the MPICH2 engine wth the correct number of mpd processes
- mpiexec - start up the MPIC2 program
- mpdallexit - close down the MPICH2 engine and all mpd processes
mpd - MPI process manager daemon
- In the directory where you will be running your MPI program, create
a file called mpd.hosts which will contain the name(s) of the
computers and the number of processes on each computer where you will
be running your program.
- If
you are going to be running it on all 4 cores of each of two computers
called t01 and t02, the file will contain the following:
- Then issue the mpdboot command to boot the MPICH2 engine with the
correct number of mpd processes:
- mpdboot -f mpd.hosts -n 2
- note: 2 is the number of nodes you will be using
- Next start your MPI program using the mpiexec
command:
- mpiexec -np 8 mpi_program_name [program arguments]
- You can run the mpiexec command as many time as needed
and when you are finished, issue the following command to close down
the MPICH2 engine and all of the mpd processes:
On computer t01:
t01:~> mpiexec -n 8 hello_world_c
Hello world from process 1 of 8
Hello world from process 6 of 8
Hello world from process 0 of 8
Hello world from process 3 of 8
Hello world from process 4 of 8
Hello world from process 2 of 8
Hello world from process 5 of 8
Hello world from process 7 of 8