<div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue 14. Feb 2023 at 17:17, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can you share a reproducer? I think I recall the format requiring certain things to be Int32.</blockquote><div dir="auto"><br></div><div dir="auto">By default, the byte offset used with the appended data format is UInt32. I believe that’s where the sizeof(int) is coming from. This default is annoying as it limits the total size of your appended data to be < 3 GB.</div><div dir="auto">That said, in the opening of the paraview file you can add this attribute </div><div dir="auto"><br></div><div dir="auto"><span class="hljs-attr" style="color:rgb(0,0,128);font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre">header_type</span><span style="color:rgb(0,0,128);font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre;background-color:rgb(249,249,249)">=</span><span class="hljs-string" style="color:var(--hljs-string);font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre">"UInt64"</span><br></div><div dir="auto"><br></div><div dir="auto">then the size of the offset is now UInt64 and now large files can be finally written.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Dave</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" dir="auto"><br>
<br>
Mike Michell <<a href="mailto:mi.mike1021@gmail.com" target="_blank">mi.mike1021@gmail.com</a>> writes:<br>
<br>
> Thanks for the note.<br>
> I understood that PETSc calculates the offsets for me through "boffset"<br>
> variable in plexvtu.c file. Please correct me if it is wrong.<br>
><br>
> If plexvtu.c has a bug, it could be around "write file header" part in<br>
> which the boffset is also computed. Is this correct? I am not using complex<br>
> number.<br>
> There are several mixed parts among "Int32, UInt8, PetscInt_FMT,<br>
> PetscInt64_FMT" in writing the header.<br>
><br>
> Which combination of those flags is correct for 64bit indices? I am gonna<br>
> modify plexvtu.c file with "#if defined(PETSC_USE_64BIT_INDICES)"<br>
> statement, but I do not know what is the correct form of the header flag<br>
> for 64bit indices.<br>
><br>
> It is also confusing to me:<br>
> boffset += gpiece[r].ncells * sizeof(PetscInt) + sizeof(int);<br>
> How is sizeof(PetscInt) different from sizeof(int)?<br>
><br>
> Thanks,<br>
> Mike<br>
><br>
><br>
>> On Tue, Feb 14, 2023 at 11:45 AM Mike Michell <<a href="mailto:mi.mike1021@gmail.com" target="_blank">mi.mike1021@gmail.com</a>><br>
>> wrote:<br>
>><br>
>>> I was trying to modify the header flags from "Int32" to "Int64", but the<br>
>>> problem was not resolved. Could I get any additional comments?<br>
>>><br>
>><br>
>> The calculated offsets are not correct I think.<br>
>><br>
>> Matt<br>
>><br>
>><br>
>>> Thanks,<br>
>>> Mike<br>
>>><br>
>>><br>
>>>> Thanks for the comments.<br>
>>>> To be precise on the question, the entire part of the header of the .vtu<br>
>>>> file is attached:<br>
>>>><br>
>>>> <?xml version="1.0"?><br>
>>>> <VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"><br>
>>>> <UnstructuredGrid><br>
>>>> <Piece NumberOfPoints="4872" NumberOfCells="4000"><br>
>>>> <Points><br>
>>>> <DataArray type="Float64" Name="Position" NumberOfComponents="3"<br>
>>>> format="appended" offset="0" /><br>
>>>> </Points><br>
>>>> <Cells><br>
>>>> <DataArray type="Int32" Name="connectivity"<br>
>>>> NumberOfComponents="1" format="appended" offset="116932" /><br>
>>>> <DataArray type="Int32" Name="offsets"<br>
>>>> NumberOfComponents="1" format="appended" offset="372936" /><br>
>>>> <DataArray type="UInt8" Name="types"<br>
>>>> NumberOfComponents="1" format="appended" offset="404940" /><br>
>>>> </Cells><br>
>>>> <CellData><br>
>>>> <DataArray type="Int32" Name="Rank" NumberOfComponents="1"<br>
>>>> format="appended" offset="408944" /><br>
>>>> </CellData><br>
>>>> <PointData><br>
>>>> <DataArray type="Float64" Name="Vec_0x37c89c0_4Field_0.0"<br>
>>>> NumberOfComponents="1" format="appended" offset="424948" /><br>
>>>> </PointData><br>
>>>> </Piece><br>
>>>> <Piece NumberOfPoints="4872" NumberOfCells="4000"><br>
>>>> <Points><br>
>>>> <DataArray type="Float64" Name="Position" NumberOfComponents="3"<br>
>>>> format="appended" offset="463928" /><br>
>>>> </Points><br>
>>>> <Cells><br>
>>>> <DataArray type="Int32" Name="connectivity"<br>
>>>> NumberOfComponents="1" format="appended" offset="580860" /><br>
>>>> <DataArray type="Int32" Name="offsets"<br>
>>>> NumberOfComponents="1" format="appended" offset="836864" /><br>
>>>> <DataArray type="UInt8" Name="types"<br>
>>>> NumberOfComponents="1" format="appended" offset="868868" /><br>
>>>> </Cells><br>
>>>> <CellData><br>
>>>> <DataArray type="Int32" Name="Rank" NumberOfComponents="1"<br>
>>>> format="appended" offset="872872" /><br>
>>>> </CellData><br>
>>>> <PointData><br>
>>>> <DataArray type="Float64" Name="Vec_0x37c89c0_4Field_0.0"<br>
>>>> NumberOfComponents="1" format="appended" offset="888876" /><br>
>>>> </PointData><br>
>>>> </Piece><br>
>>>> </UnstructuredGrid><br>
>>>> <AppendedData encoding="raw"><br>
>>>><br>
>>>><br>
>>>> Thanks,<br>
>>>> Mike<br>
>>>><br>
>>>><br>
>>>>> On Sun, Feb 12, 2023 at 6:15 PM Mike Michell <<a href="mailto:mi.mike1021@gmail.com" target="_blank">mi.mike1021@gmail.com</a>><br>
>>>>> wrote:<br>
>>>>><br>
>>>>>> Dear PETSc team,<br>
>>>>>><br>
>>>>>> I am a user of PETSc with Fortran. My code uses DMPlex to handle dm<br>
>>>>>> object. To print out output variable and mesh connectivity, I use VecView()<br>
>>>>>> by defining PetscSection on that dm and borrow a vector. The type of the<br>
>>>>>> viewer is set to PETSCVIEWERVTK.<br>
>>>>>><br>
>>>>>> With 32bit indices, the above work flow has no issue. However, if<br>
>>>>>> PETSc is configured with 64bit indices, my output .vtu file has an error if<br>
>>>>>> I open the file with visualization tools, such as Paraview or Tecplot,<br>
>>>>>> saying that:<br>
>>>>>> "Cannot read cell connectivity from Cells in piece 0 because the<br>
>>>>>> "offsets" array is not monotonically increasing or starts with a value<br>
>>>>>> other than 0."<br>
>>>>>><br>
>>>>>> If I open the .vtu file from terminal, I can see such a line:<br>
>>>>>> ...<br>
>>>>>> <DataArray type="Int32" Name="connectivity" NumberOfComponents="1"<br>
>>>>>> format="appended" offset="580860" /><br>
>>>>>> ...<br>
>>>>>><br>
>>>>>> I expected "DataArray type="Int64", since the PETSc has 64bit indices.<br>
>>>>>> Could I get recommendations that I need to check to resolve the issue?<br>
>>>>>><br>
>>>>><br>
>>>>> This is probably a bug. We will look at it.<br>
>>>>><br>
>>>>> Jed, I saw that Int32 is hardcoded in plexvtu.c, but sizeof(PetscInt)<br>
>>>>> is used to calculate the offset, which looks inconsistent. Can you take a<br>
>>>>> look?<br>
>>>>><br>
>>>>> Thanks,<br>
>>>>><br>
>>>>> Matt<br>
>>>>><br>
>>>>><br>
>>>>>> Thanks,<br>
>>>>>> Mike<br>
>>>>>><br>
>>>>><br>
>>>>><br>
>>>>> --<br>
>>>>> What most experimenters take for granted before they begin their<br>
>>>>> experiments is infinitely more interesting than any results to which their<br>
>>>>> experiments lead.<br>
>>>>> -- Norbert Wiener<br>
>>>>><br>
>>>>> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
>>>>> <<a href="http://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">http://www.cse.buffalo.edu/~knepley/</a>><br>
>>>>><br>
>>>><br>
>><br>
>> --<br>
>> What most experimenters take for granted before they begin their<br>
>> experiments is infinitely more interesting than any results to which their<br>
>> experiments lead.<br>
>> -- Norbert Wiener<br>
>><br>
>> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
>> <<a href="http://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">http://www.cse.buffalo.edu/~knepley/</a>><br>
>><br>
</blockquote></div></div>