MPI related question: how to evaluate a coefficient function

More
5 years 7 months ago #1543 by Guosheng Fu
I am trying to evaluate a grid function at a specific mesh point, but it failed for the MPI version with the following snippet...
Code:
if mesh.Contains(0,0): gfu(mesh(0,0))
More
5 years 7 months ago - 5 years 7 months ago #1548 by lkogler
It looks like empty meshes (rank 0 has no elements) are not handled correctly.
As a workaround:
Code:
if mesh.comm.rank!=0 and mesh.Contains(0,0): gfu(mesh(0,0))
Should be fixed shortly.
Last edit: 5 years 7 months ago by lkogler.
More
5 years 7 months ago #1549 by Guosheng Fu
Thanks!
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...
More
5 years 7 months ago - 5 years 7 months ago #1553 by lkogler
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.
Code:
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:
Code:
#!/bin/sh $@ 1>out_p$OMPI_COMM_WORLD_RANK 2>err_p$OMPI_COMM_WORLD_RANK
Then you can use gdb on each process, and tell it to print the back-trace when it encounters a problem
Code:
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.
Last edit: 5 years 7 months ago by lkogler.
Time to create page: 0.124 seconds