[petsc-users] DMLabel Synchronize

Matthew Knepley knepley at gmail.com
Fri Sep 2 06:27:32 CDT 2022


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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220902/db398ed7/attachment.html>


More information about the petsc-users mailing list