[petsc-users] DMLocalToLocal with DMPlex in Fortran

Mike Michell mi.mike1021 at gmail.com
Sun Oct 2 10:56:13 CDT 2022


Thank you for the reply.
Sure, a short example code is attached here with a square box mesh and a
run script.
Inside the source, you may find two versions of halo exchange; one is for
local to global (Version-1) and another one is for local to local
(Version-2), which is not working in my case.
In the output.vtu, you will see the halo exchanged vector resolved to each
vertex with (myrank + 1), so if the code is running with 2procs, at the
parallel boundary, you will see 3. In this example, there is no ghost layer.

Thanks,
Mike


> On Sat, Oct 1, 2022 at 8:51 PM Mike Michell <mi.mike1021 at gmail.com> wrote:
>
>> Thank you for the reply. There is that file in src/dm/interface/ftn-auto/
>> for me, instead of the path you mentioned.
>>
>> After "make allfortranstubs" was done and, PETSc reconfigured and
>> reinstalled.
>>
>> However, I still have the same problem at the line in which
>> DMLocalToLocalBegin() is used. What I am doing to setup halo exchange is as
>> follows;
>> - declare DMPlex
>> - PetscSectionCreate()
>> - PetscSectionSetNumFields()
>> - PetscSectionSetFieldComponents()
>> - PetscSectionSetChart()
>> - do loop over dofs: PetscSectionSetDof() and PetscSectionSetFieldDof()
>> - PetscSectionSetUp()
>> - DMSetLocalSection()
>> - PetscSectionDestroy()
>> - DMGetSectionSF()
>> - PetscSFSetUp()
>>
>> Then, the halo exchange is performed as follows;
>> - DMGetLocalVector()
>> - Fill the local vector
>> - DMLocalToLocalBegin() --(*)
>> - DMLocalToLocalEnd()
>> - DMRestoreLocalVector()
>>
>> Then, the code crashes at (*).
>>
>
> Can you send something I can run? Then I will find the problem and fix it.
>
>   Thanks,
>
>      Matt
>
>
>> Previously(at the time PETSc did not support LocalToLocal for DMPlex in
>> Fortran), the part above, "DMLocalToLocalBegin() and DMLocalToLocalEnd()",
>> consisted of;
>> - DMLocalToGlobalBegin()
>> - DMLocalToGlobalEnd()
>> - DMGlobalToLocalBegin()
>> - DMGlobalToLocalEnd()
>> and it worked okay.
>>
>> I am unclear which part is causing the problem. Shall I define the
>> PetscSection and PetscSF in different ways in case of Local to Local Halo
>> exchange?
>> Any comment will be appreciated.
>>
>> Thanks,
>> Mike
>>
>>
>>
>>> On Fri, Sep 30, 2022 at 4:14 PM Mike Michell <mi.mike1021 at gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> As a follow-up to this email thread,
>>>> https://www.mail-archive.com/petsc-users@mcs.anl.gov/msg44070.html
>>>>
>>>> Are DMLocalToLocalBegin() and DMLocalToLocalEnd() really available for
>>>> DMPlex with Fortran on the latest version of PETSc (3.17.99 from GitLab)?
>>>> Matt commented that the Fortran bindings were updated so that those
>>>> functions must be available in the latest version of PETSc, however, it
>>>> seems still they are not working from my test with DMPlex in Fortran. Can
>>>> anyone provide some comments? Probably I am missing some mandatory header
>>>> file? Currently, I have headers;
>>>>
>>>> #include "petsc/finclude/petscvec.h"
>>>> #include "petsc/finclude/petscdmplex.h"
>>>> #include "petsc/finclude/petscdmlabel.h"
>>>> #include "petsc/finclude/petscdm.h"
>>>>
>>>
>>> The source for these functions is in
>>>
>>>   src/dm/ftn-auto/dmf.c
>>>
>>> Is it there for you? If not, you can run
>>>
>>>   make allfortranstubs
>>>
>>> Fortran functions are not declared, so the header should not matter for
>>> compilation, just the libraries for linking.
>>>
>>>   Thanks,
>>>
>>>      Matt
>>>
>>>
>>>> Thanks,
>>>> Mike
>>>>
>>>
>>>
>>> --
>>> 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/>
>>>
>>
>
> --
> 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/20221002/7da5ee72/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test_Halo.tar
Type: application/x-tar
Size: 81920 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221002/7da5ee72/attachment-0001.tar>


More information about the petsc-users mailing list