[MPICH] Tracing the mpich library with gdb and xtern

Darius Buntinas buntinas at mcs.anl.gov
Wed Jan 2 10:21:06 CST 2008


I'm not sure exactly what you want to do, so here are a few ideas.

If you want to start rank 0 before rank 1, you can change your test 
program so it calls mpi_commrank right after mpi_init.  Then set a 
breakpoint just after mpi_commrank, and when you hit the breakpoint, you 
can look at the rank and decide which one to continue running.

If you can't modify the test program, you can set the breakpoint just 
after mpi_init, then read MPIDI_Process.my_pg_rank.  You'll have to 
configure MPICH2 with --enable-g=dbg to get debugging symbols added (you 
might also want to configure with --disable-compiler-optimizations to 
remove the -O2 flag and make it easier to step through the code).

If you really need to know the rank of a process before mpi_init is 
called, you can read the PMI_RANK environment variable.  Note that 
mpi_init performs an implicit barrier, so if one process calls mpi_init, 
it won't exit until all other processes have called mpi_init, so even if 
you start one process before the others, it won't get past mpi_init.

Hope that helps,
-d

On 12/31/2007 04:07 AM, Krishna Chaitanya wrote:
> Hi,
>                I have been tracing the flow of the mpich code by 
> executing a simple program having MPI_Send() and MPI_Recv(),on one 
> machine.  I have been using gdb along with xtern to have two windows 
> open at the same time as I step through the code. I wish to get a better 
> glimpse of the working of the point to point calls, by launching the job 
> on two machines and by tracing the flow in a similar manner. Could you 
> please tell me how I can go about it? I have a feeling that this can be 
> done by hard-coding the macros and telling the daemons directly that one 
> machine is rank1 and the other is rank2. That way, i can start rank1 
> process first and the rank2 process a little later and trace through the 
> code.
>              
> Thanks,
> Krishna Chaitanya,
> Dept of Information Technology,
> National Institute of Technology, Karnataka ( NITK )
> India
> 
> -- 
> In the middle of difficulty, lies opportunity




More information about the mpich-discuss mailing list