- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.7k
 
Description
It would be good to have a very basic support of debugging MPI programs.
Outside of VSCode I can attach a debugger to each terminal via
mpirun -np 2 xterm -e lldb -f my_exec
and then do the standard serial debugging in each terminal window.
Alternative is to hack-in into the source a piece of code which prints process ID and waits so that a user can attach a debugger to some/all processes, see https://www.open-mpi.org/faq/?category=debugging#serial-debuggers .
With vscode-cpptools one can already adopt the latter via launch.json and its "processId": "${command:pickProcess}" option.
It would be great, if vscode-cpptools goes one step further by extending the launch config with
    {
      "num_mpi_processes" : "4",
      "mpi_exec": "<path-to-mpirun>"
    },
and in the background simply attach gdb/lldb debugger for each MPI process and perhaps append a number to the "name": "(lldb) Attach", so that one can use the available GUI.
One would, of course, need to manually switch between debuggers for each process in the GUI but this should be fine for up to 4-8 processes, which is often enough to find bugs in MPI programs.
p.s. AFAIK the only other non-commerical project with MPI debugger is Eclipse PTP, but last time I checked it was limited to Linux.