[petsc-users] Question about DMPlex for parallel computing

Matthew Knepley knepley at gmail.com
Mon Oct 18 05:43:51 CDT 2021


On Mon, Oct 18, 2021 at 12:26 AM Gong Yujie <yc17470 at connect.um.edu.mo>
wrote:

> Hi,
>
> I'm learning to use DMPlex to write a parallel program. I've tried to
> write a sequential code earlier successfully, but when to write a parallel
> code, there are many things different. There are some questions I'm
> curious about.
>
>
>    1. Are the functions as DMPlexCreateGmshFromFile() and other read from
>    file functions reading in the mesh in parallel? Or just the root node read
>    in the mesh?
>
> This function works in parallel, meaning it will correctly read a file if
run from a parallel program. However, it is read only by proc 0. The only
format that we have truly reading in parallel
is the PETSc HDF5 format, which relies on the parallel reads from HDF5.

>
>    1. Are there some examples available for distribute the mesh and
>    create the correspondingly local to global node(or position) mapping ?
>
> Yes, hundreds of examples. For example, in SNES ex12, we have many
parallel examples, such as

  https://gitlab.com/petsc/petsc/-/blob/main/src/snes/tutorials/ex12.c#L1182

You will notice it has '-dm_distribute' in the arguments, which distributes
the mesh automatically which was read in or created serially. You can also
call

  DMPlexDistribute()

yourself instead of using the option.

  Thanks,

     Matt


> I'm grateful for your kindly help!
>
> Best Regards,
> Gong
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211018/01977258/attachment-0001.html>


More information about the petsc-users mailing list