Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

MPI related question: how to evaluate a coefficient function

More
4 years 11 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
4 years 11 months ago - 4 years 11 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: 4 years 11 months ago by lkogler.
More
4 years 11 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
4 years 11 months ago - 4 years 11 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: 4 years 11 months ago by lkogler.
Time to create page: 0.099 seconds