[petsc-users] Starting in debugger

Sanjay Govindjee s_g at berkeley.edu
Sat Apr 16 19:17:13 CDT 2022

I would like to start up some runs in the debugger and am running into 
two primary issues.

(1) seem to not be able to control which debugger is used and
(2) there are errors in the start up, lastly
(3) if I do manage to start to job in the debugger (through manual 
means), then running it is a bit of roulette as to if the job will 
continue in the debugger.

I have petsc-3.17 built with GCC compilers and 
--with-debugger=/usr/local/bin/gdb (using a patch Barry Smith created 

[1] When I execute "mpirun -n 2 hellow  -debugger_terminal Terminal"   
or  "mpirun -n 2 hellow -start_in_debugger gdb -debugger_terminal 
Terminal".   I am getting lldb in the debugging windows.

[2] The second problem I am seeing is that in the window where I have 
run mpirun, the job exits with an mpirun message as shown.

$ mpirun -n 2 hellow -start_in_debugger gdb -debugger_terminal Terminal
mpirun has exited due to process rank 1 with PID 0 on
node Sanjays-MacBook-Pro2020 exiting improperly. There are three reasons 
this could occur:

1. this process did not call "init" before exiting, but others in
the job did. This can cause a job to hang indefinitely while it waits
for all processes to call "init". By rule, if one process calls "init",
then ALL processes must call "init" prior to termination.

2. this process called "init", but exited without calling "finalize".
By rule, all processes that call "init" MUST call "finalize" prior to
exiting or it will be considered an "abnormal termination"

3. this process called "MPI_Abort" or "orte_abort" and the mca parameter
orte_create_session_dirs is set to false. In this case, the run-time cannot
detect that the abort call was an abnormal termination. Hence, the only
error message you will receive is this one.

This may have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).

You can avoid this message by specifying -quiet on the mpirun command line.

[3] If I just do something like "mpirun -n 5 xterm -e /usr/local/bin/gdb 
hellow"; I get gdb running in xterm which is ok to some extent, though I 
prefer Terminal.  However, I do run into the problem that the order in 
which I issue 'run' at the (gdb) prompt dictates if the program will 
launch or not.  Sometimes I guess the order correctly and the job runs, 
other times it just hangs.


More information about the petsc-users mailing list