[petsc-users] DMLabel Synchronize

Matthew Knepley knepley at gmail.com
Wed Sep 7 08:44:12 CDT 2022


On Sun, Sep 4, 2022 at 5:50 PM Nicholas Arnold-Medabalimi <
narnoldm at umich.edu> wrote:

> Thank you. I'm able to access the label functions. Can you clarify what
> the Begin and End functions are doing?
>
> To clarify the behavior I am trying to achieve, I have identified the blue
> cell in the attached figure using metrics during the solve. I have already
> created a label across all the partitions I'm using to tag the identified
> and adjacent cells however I need the Root cell label to be updated to one
> when the initial identified cell is adjacent to its corresponding leaf.
> That doesn't seem to be happening with I use the propagate command, but I
> may be misusing them. I appreciate the assistance.
>

I need to explain in more detail what is happening. Propagate ensures that
all points involved in the PetscSF for points, meaning all shared points,
have the same label values. In your diagram, it would appear that the 3
faces in red are shared, so label values on those faces would be made
consistent across processes.

>From your description, it would appear that you have at least 2 choices:

  1) Label faces as well, with the rule that face labels cause any cell in
the support to be labeled, and labeling a cell also labels its faces

  2) Partition with a cell overlap

  Thanks,

     Matt


> [image: image.png]
>
>
> Sincerely
> Nicholas
>
>
>
> On Fri, Sep 2, 2022 at 7:27 AM Matthew Knepley <knepley at gmail.com> wrote:
>
>> On Fri, Sep 2, 2022 at 12:53 AM Nicholas Arnold-Medabalimi <
>> narnoldm at umich.edu> wrote:
>>
>>> I've been trying to update from the snapshot to the main branch on the
>>> gitlab but I'm having one issue. This does not occur using the snapshot
>>> petsc mentioned previously.
>>>
>>> I use a PetscViewer to read in a file. The appended function is used to
>>> fast-forward to the locations in the file.  Looking at the error message, I
>>> thought maybe the file wasn't opening properly. However, I am able to read
>>> in and print the first line of the file using PetscViewerRead. As far as I
>>> can tell, the error is only due to the version change and I see something
>>> about the viewer in the compatibility notes, but I'm not sure how to
>>> resolve it. Any assistance would be appreciated since I can't use the
>>> gitlab version for the label functions without fixing this.
>>>
>>
>> You are missing "PetscFunctionBeginUser;" at the start of your function.
>> This must be paired with all PetscFunctionReturn() calls since we keep
>> track of the stack. We added this check in the new version.
>>
>>   Thanks,
>>
>>     Matt
>>
>>
>>>
>>> PetscErrorCode FileFastForward(PetscViewer viewer, char delim, bool &eof
>>> )
>>> {
>>>     int i = 0, ret = 0;
>>>     char buffer;
>>>     do
>>>         PetscViewerRead(viewer, &(buffer), 1, &ret, PETSC_CHAR);
>>>     while (ret > 0 && buffer != delim);
>>>     if (ret == 0)
>>>     {
>>>         printf("End of file reached before delimiter found\n");
>>>         eof = false;
>>>     }
>>>     else
>>>         eof = true;
>>>     PetscFunctionReturn(0);
>>> }
>>> The viewer is opened using
>>>     PetscViewerCreate(PETSC_COMM_WORLD, &viewer);
>>>     PetscViewerSetType(viewer, PETSCVIEWERASCII);
>>>     PetscViewerFileSetMode(viewer, FILE_MODE_READ);
>>>     PetscViewerFileSetName(viewer, meshfile);
>>> The error that is thrown is
>>>
>>> [0]PETSC ERROR: --------------------- Error Message
>>> --------------------------------------------------------------
>>> [0]PETSC ERROR: Petsc has generated inconsistent data
>>> [0]PETSC ERROR: Invalid stack size 0, pop FileFastForward
>>> /home/narnoldm/code/solver-playground/version_upgrade/version_debug.cpp:35.
>>> (Note this line is the PetscFunctionReturn)
>>>
>>> [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
>>> [0]PETSC ERROR: Petsc Development GIT revision: unknown  GIT Date:
>>> unknown
>>> [0]PETSC ERROR: /home/narnoldm/code/solver-playground/build/bin/version
>>> on a  named Dragoon by narnoldm Fri Sep  2 00:34:02 2022
>>> [0]PETSC ERROR: Configure options
>>> --prefix=/home/narnoldm/code/solver-playground/build/external/PETSc
>>> --with-hdf5-dir=/home/narnoldm/code/solver-playground/build/external/HDF5
>>> --download-triangle --download-parmetis --download-metis --with-debugging=1
>>> [0]PETSC ERROR: #1 FileFastForward() at
>>> /home/narnoldm/code/solver-playground/version_upgrade/version_debug.cpp:35
>>> application called MPI_Abort(MPI_COMM_SELF, 77) - process 0
>>> [unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=77
>>> :
>>> system msg for write_line failure : Bad file descriptor
>>>
>>>
>>>
>>> On Thu, Sep 1, 2022 at 5:32 AM Matthew Knepley <knepley at gmail.com>
>>> wrote:
>>>
>>>> On Wed, Aug 31, 2022 at 9:30 PM Nicholas Arnold-Medabalimi <
>>>> narnoldm at umich.edu> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> Thanks, this looks like what I need, but I don't seem to have it in my
>>>>> release (3.17.4 from
>>>>> https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.17.4.tar.gz).
>>>>> I see it in the current repository, though. Is the 3.17.4 tarball just
>>>>> missing it, or will it be added in the next release?
>>>>>
>>>>
>>>> Yes, it is in main (https://petsc.org/main/docs/changes/dev/) since it
>>>> was an interface change. Our main branch is quite stable, and I would
>>>> recommend
>>>> it for development work.
>>>>
>>>>   Thanks,
>>>>
>>>>      Matt
>>>>
>>>>
>>>>> Thanks
>>>>> Nicholas
>>>>>
>>>>> On Wed, Aug 31, 2022 at 7:45 AM Matthew Knepley <knepley at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> On Tue, Aug 30, 2022 at 6:37 PM Nicholas Arnold-Medabalimi <
>>>>>> narnoldm at umich.edu> wrote:
>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> Thanks for all the help. I'm looking to tag several cells based on
>>>>>>> metrics occurring at run time. In addition to the metric-defined cells I
>>>>>>> also want to label the surrounding cells. This is no problem as I can
>>>>>>> traverse the DMPlex chart to get the neighboring cells. The issue only
>>>>>>> arises if an identified cell is on a partition boundary. this leads to the
>>>>>>> neighbor cell in the overlap halo being tagged. However, the root cell on
>>>>>>> the adjacent partition is not tagged. Is there a built-in way to
>>>>>>> synchronize the labels from the leafs to the roots?
>>>>>>>
>>>>>>> Right now, I iterate through the root and leaf cells of each
>>>>>>> processor, but it is somewhat wasteful as I don't see a way for the root
>>>>>>> cell partition to know if a corresponding leaf cell label value without
>>>>>>> communicating it first.
>>>>>>>
>>>>>>
>>>>>> What I think you want is this:
>>>>>>
>>>>>>
>>>>>> https://petsc.org/main/docs/manualpages/DMLabel/DMLabelPropagateBegin/
>>>>>>
>>>>>> I use this to do the same kind of labeling I think. It is setup to
>>>>>> allow multiple rounds,
>>>>>> so that you can use the communicated labeling to continue on the new
>>>>>> rank.
>>>>>>
>>>>>> Will this work?
>>>>>>
>>>>>>   Thanks,
>>>>>>
>>>>>>      Matt
>>>>>>
>>>>>>
>>>>>>> Thanks
>>>>>>> Nicholas
>>>>>>>
>>>>>>> --
>>>>>>> Nicholas Arnold-Medabalimi
>>>>>>>
>>>>>>> Ph.D. Candidate
>>>>>>> Computational Aeroscience Lab
>>>>>>> University of Michigan
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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/>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Nicholas Arnold-Medabalimi
>>>>>
>>>>> Ph.D. Candidate
>>>>> Computational Aeroscience Lab
>>>>> University of Michigan
>>>>>
>>>>
>>>>
>>>> --
>>>> 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/>
>>>>
>>>
>>>
>>> --
>>> Nicholas Arnold-Medabalimi
>>>
>>> Ph.D. Candidate
>>> Computational Aeroscience Lab
>>> University of Michigan
>>>
>>
>>
>> --
>> 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/>
>>
>
>
> --
> Nicholas Arnold-Medabalimi
>
> Ph.D. Candidate
> Computational Aeroscience Lab
> University of Michigan
>


-- 
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/20220907/92e95900/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 50054 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220907/92e95900/attachment-0001.png>


More information about the petsc-users mailing list