<div dir="ltr"><div dir="ltr">On Mon, Dec 6, 2021 at 11:28 AM Quentin Chevalier <<a href="mailto:quentin.chevalier@polytechnique.edu">quentin.chevalier@polytechnique.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello PETSc users,<br><br>This email is a duplicata of <a href="https://gitlab.com/petsc/petsc/-/issues/1070" target="_blank">this gitlab issue</a>, sorry for any inconvenience caused.<br><br>I want to compute a PETSc vector in real mode, than perform calculations with it in complex mode. I want as much of this process to be parallel as possible. Right now, I compile PETSc in real mode, compute my vector and save it to a file, then switch to complex mode, read it, and move on.<br><br>This creates unexpected behaviour using MPIIO, so on Lisandro Dalcinl's advice I'm moving to HDF5 format. My code is as follows (taking inspiration from<a href="https://www.mcs.anl.gov/petsc/petsc4py-current/docs/apiref/petsc4py.PETSc.Viewer-class.html#section-NestedClasses" target="_blank"> petsc4py doc</a>, a <a href="https://bitbucket.org/petsc/petsc4py/issues/70/difficulties-in-reading-from-hdf5-file" target="_blank">bitbucket example</a> and <a href="https://bitbucket.org/petsc/petsc4py/pull-requests/51/add-save-in-hdf5-format-demo" target="_blank">another one</a>, all top Google results for 'petsc hdf5') :<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><pre lang="python"><span id="gmail-m_-276088734184815115gmail-LC1" lang="python"><span>viewer</span> <span>=</span> <span>PETSc</span><span>.</span><span>Viewer</span><span>().</span><span>createHDF5</span><span>(</span><span>file_name</span><span>,</span> <span>'r'</span><span>,</span> <span>COMM_WORLD</span><span>)</span></span>
<span id="gmail-m_-276088734184815115gmail-LC2" lang="python"><span>q</span><span>.</span><span>load</span><span>(</span><span>viewer</span><span>)</span></span>
<span id="gmail-m_-276088734184815115gmail-LC3" lang="python"><span>q</span><span>.</span><span>ghostUpdate</span><span>(</span><span>addv</span><span>=</span><span>PETSc</span><span>.</span><span>InsertMode</span><span>.</span><span>INSERT</span><span>,</span> <span>mode</span><span>=</span><span>PETSc</span><span>.</span><span>ScatterMode</span><span>.</span><span>FORWARD</span><span>)</span></span>
</pre></blockquote><br>This crashes my code. I obtain traceback :<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><pre lang="shell"><span id="gmail-m_-276088734184815115gmail-LC1" lang="shell">  File <span>"/home/shared/code.py"</span>, line 121, <span>in </span>Load</span>
<span id="gmail-m_-276088734184815115gmail-LC2" lang="shell">    viewer <span>=</span> PETSc.Viewer<span>()</span>.createHDF5<span>(</span>file_name, <span>'r'</span>, COMM_WORLD<span>)</span></span>
<span id="gmail-m_-276088734184815115gmail-LC3" lang="shell">  File <span>"PETSc/Viewer.pyx"</span>, line 182, <span>in </span>petsc4py.PETSc.Viewer.createHDF5</span>
<span id="gmail-m_-276088734184815115gmail-LC4" lang="shell">petsc4py.PETSc.Error: error code 86</span>
<span id="gmail-m_-276088734184815115gmail-LC5" lang="shell"><span>[</span>0] PetscViewerSetType<span>()</span> at /usr/local/petsc/src/sys/classes/viewer/interface/viewreg.c:442</span>
<span id="gmail-m_-276088734184815115gmail-LC6" lang="shell"><span>[</span>0] Unknown type. Check <span>for </span>miss-spelling or missing package: <a href="https://petsc.org/release/install/install/#external-packages" target="_blank">https://petsc.org/release/install/install/#external-packages</a></span>
<span id="gmail-m_-276088734184815115gmail-LC7" lang="shell"><span>[</span>0] Unknown PetscViewer <span>type </span>given: hdf5</span></pre></blockquote></div></blockquote><div>This means that PETSc has not been configured with HDF5 (--with-hdf5 or --download-hdf5), so the container should be updated.</div><div><br></div><div>  THanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I have petsc4py 3.16 from <a href="https://hub.docker.com/r/dolfinx/dolfinx" target="_blank">this docker container</a> (<a href="https://docs.fenicsproject.org/dolfinx/main/python/installation.html#dependencies" target="_blank">list of dependencies</a> include PETSc and petsc4py).</div><div><br></div>I'm pretty sure this is not intended behaviour. Any insight as to how to fix this issue (I tried running <code>./configure --with-hdf5</code> to no avail) or more generally to perform this jiggling between real and complex would be much appreciated,<br><br>Kind regards.<br><br>Quentin<br></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>