If your configuration of mpich used -device=ch_p4, then some of the p4 debugging capabilities are available to you. The most useful of these are the command line argments to the application program. Thus
mpirun -np 10 myprog -p4dbg 20 -p4rdbg 20will result in program tracing information at a level of 20 being writtin to stdout during execution. For more information about what is printed at what levels, see the p4 Users' Guide [1].