I am trying to debug an open-source C code with MPI. This open-source has it own Cmakefile. I enable the mpi and debug model with the instructions of the open-source in the terminal. After the executable file named gmx_mpi is created, I import the project to visual studio code. I can run the executable file in terminal with below command
"mpirun -np 4 gmx_mpi mdrun -s diff.tpr -c diff.gro -ntomp 1"
So I made below configurations to debug the code with MPI in the visual studio code.
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/usr/bin/mpirun",
"args": ["-np","4","/home/fanli/workspace/gromacs_fh_debug/build/bin/gmx_mpi","mdrun","-s","diff.tpr","-deffnm","diff","-ntomp","1"],
"stopAtEntry": false,
"cwd": "/home/fanli/workspace/protein_water/double/40ms",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
However, the code did not stop at the breakpoint I set, instead it run directly as if the it is in the release mode.
I googled a lot but did not find the solution.
Could anyone tell me how to debug the MPI code in visual studio code.