[petsc-users] Starting in debugger

Sanjay Govindjee s_g at berkeley.edu
Sun Apr 17 00:10:50 CDT 2022

Thanks Barry.

mpirun -n 2 myapp -start_in_debugger now starts up two Terminal windows 
with gdb.

I still face issues [2] and [3], but I think I am going to move over to 
a linux box for a bit where I can control things better.


On 4/16/22 8:13 PM, Barry Smith wrote:
>     You should be able to use -start_in_debugger -debug_terminal xterm
>     When I added support for Apple Terminal it seems I hardwired it only for lldb. I've attached a patch that will make it also work for gdb so that just -start_in_debugger should open Terminal windows with the gdb debugger for you.
>    Barry
>> On Apr 16, 2022, at 8:17 PM, Sanjay Govindjee <s_g at berkeley.edu> wrote:
>> 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 today).
>> [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.
>> -sanjay

More information about the petsc-users mailing list