MPI related question: how to evaluate a coefficient function

I am trying to evaluate a grid function at a specific mesh point, but it failed for the MPI version with the following snippet…

if mesh.Contains(0,0): 

It looks like empty meshes (rank 0 has no elements) are not handled correctly.
As a workaround:

if mesh.comm.rank!=0 and mesh.Contains(0,0):

Should be fixed shortly.

Say, do you have any suggestions on code debugging in MPI?
It would be a good exercise for me to trace a bug and try to fix it myself first before asking these small questions…

I have not found a solution I am really satisfied with myself, but I can tell you what I usually do.
Just keep in mind that this is all just cobbled together.

For small jobs, you can run each MPI process in a seperate xterm-window and attach gdb to each of them.

mpirun -np 1 gdb -ex run --args python3 PYTHON_SCRIPT : \
             -np X xterm -hold -e gdb -ex run --args  python3 PYTHON_SCRIPT

You can also pipe the output of each process to a seperate file, for example, with OpenMPI you could write
a small script like this:


Then you can use gdb on each process, and tell it to print the back-trace when it encounters a problem

mpirun -np X  bash WRAP_SCRIPT gdb -batch -ex "run" -ex bt --args python3 PYTHON_SCRIPT 

This way you can do bigger jobs, but you cannot use gdb interactively.

This also works with valgrind instead of gdb.