Unless I'm mistaken, there is no -dbg runtime option. Also, the configure flag you're using is for debugging MPICH itself, not the application, so you can safely ignore it. Debugging parallel applications is always tricky. Short of using a real parallel debugger (Totalview, DDT, etc.), you can use some tricks to get gdb to work. 

1) mpiexec -n 1 gdb <application> : -n <nun procs - 1> <application>

This will start up the application and attach a debugger to process 0. I think this will only work if rank 0 is local, but that's often enough for debugging purposes. 

2) Insert a sleep or while loop in the code of the target process. 

If you cause the process that you want to debug to busy wait, you can give yourself enough time to ssh to it and attach a debugger with something like 'gdb --pid <pid>'.  

There are probably other tricks that would work, but these are the two most common. Give them a shot and one should work for you. 

Thanks,
Wesley

On Nov 17, 2013, at 10:55 PM, "ylniu@iccas.ac.cn" <ylniu@iccas.ac.cn> wrote:

Dear all,
 
I want to debug parallel fortran program with idb.
 
The configure parameter of MPICH2 or MPICH3 is as follows:
 
./configure --prefix=$HOME/program/mpich/mpich2-1.4.1p1 \
            --enable-f77 --enable-fc F77=ifort FC=ifort \
            FFLAGS="-g -traceback -checkall" FCFLAGS="-g -traceback -checkall" \
            --enable-static --enable-g=dbg \
            --enable-traceback --enable-f90modules
 
or
 
./configure --prefix=$HOME/program/mpich/mpich2-1.4.1p1 \
            --enable-f77 --enable-fc F77=ifort FC=ifort \
            FFLAGS="-g -traceback -checkall" FCFLAGS="-g -traceback -checkall" \
            --enable-static --enable-g=all \
            --enable-traceback --enable-f90modules
 
 
mpirun -machinefile $PBS_NODEFILE -np $NPROCS -gdb=idb -parallel myprogram -npool 1
 
There comes the error message:
=======================================================================================
match_arg (./utils/args/args.c:160): unrecognized argument dbg
HYDU_parse_array (./utils/args/args.c:175): argument matching returned error
parse_args (./ui/mpich/utils.c:1609): error parsing input array
HYD_uii_mpx_get_parameters (./ui/mpich/utils.c:1660): unable to parse user arguments
main (./ui/mpich/mpiexec.c:153): error parsing parameters
=======================================================================================
 
How can mpirun recognition the argument "dbg"?
 
Best regards!
 

_______________________________________________
discuss mailing list     discuss@mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss