Is there a way to retrieve global array when running in parallel


54
views
0
4 weeks ago by
I am solving a 2D Poisson equation on a large domain in parallel. Is there a way to retrieve the complete array of vertex values for instance for process 0 ? I searched for wrappers of MPI procedures but the documentation of these is not clear...
Many thanks
Community: FEniCS Project

1 Answer


0
25 days ago by
If you are running 2018.1 and have mpi4py then it should be quite easy (even though the documentation for mpi4py is not fantastic):
comm = mesh.mpi_comm()

arr_local = ... # some array that is different on each rank

arrs = comm.gather(arr_local)

if comm.rank == 0:
    # You have a list of arrays from each rank
    # arrs[rank] should be equal to arr_local on
    # the given rank
else:
    assert arrs is None​

You will probably want to send both vertex coordinates and vertex values. You can even send a tuple of (coords, values) if you want (i think ...)
Please login to add an answer/comment or follow this question.

Similar posts:
Search »