pygdbmi icon indicating copy to clipboard operation
pygdbmi copied to clipboard

Support for Intel's MPI debugging

Open lsmenicucci opened this issue 1 year ago • 2 comments

When starting gdb from intel's mpirun using:

mpirun -gdb -gdb-args --interpreter=mi3 -n 2 ./my-prog 

output has an leading indicator of which processes are being debugged, for example:

[0,1] (mpigdb) run

which breaks the output parsing. By proxying the gdbmiparser.parse_response I can easily restore the structured output:

mpigdb_prefix = re.compile(r"^\s*(\(mpigdb\))?\s*\[[0-9,]+\]\s")
parse = gdbmiparser.parse_response 

def new_parse(a0, *args, **kwargs):
    newa0 = mpigdb_prefix.sub("", a0) 
    return parse(newa0, *args, **kwargs)

gdbmiparser.parse_response = new_parse

But the mpi rank information is lost. It would be nice if such information could be included in the parsed output.

lsmenicucci avatar Oct 11 '23 16:10 lsmenicucci

I'm not familiar with mpirun, but its behaviour is a bit annoying as that's not valid MI 😞

barisione avatar Oct 11 '23 16:10 barisione

Yes, although it seems that the only difference is the prepended (0,1) (mpigdb) I haven't found any mpich/intel mpi documentation pointing that out. I've also had some random errors while parsing because there is an apparent race condition between the processes output and the MI output.

What really solved these issues was redirecting the gdb output to a file by enabling logging, like:

set pagination off
set logging file gdb.log 
set logging overwrite on

And then parse the gdb.log content with pygdbmi.gdbmiparser.

lsmenicucci avatar Oct 13 '23 21:10 lsmenicucci