The -dbx option to mpirun causes processes to be run under the control of the dbx debugger. This depends on cooperation between dbx and mpich and does not always work; if it does not, you will know immediately. If it does work, it is often the simplest way to debug MPI programs. Similiarly, the argument -gdb makes use of the GNU debugger.
For example, enter
mpirun -dbx or mpirun -gdb a.outIn some cases, you will have to wait until the program completes and then type run to run the program again. Also, mpirun relies on the -sr argument to dbx (this tells dbx to read initial commands from a file). If your dbx does not support that feature, mpirun will fail to start your program under the debugger.