<div dir="ltr">Hello PETSc users,<br><br>This email is a duplicata of <a href="https://gitlab.com/petsc/petsc/-/issues/1070">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"> petsc4py doc</a>, a <a href="https://bitbucket.org/petsc/petsc4py/issues/70/difficulties-in-reading-from-hdf5-file">bitbucket example</a> and <a href="https://bitbucket.org/petsc/petsc4py/pull-requests/51/add-save-in-hdf5-format-demo">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 class="gmail-code gmail-highlight" lang="python"><span id="gmail-LC1" class="gmail-line" lang="python"><span class="gmail-n">viewer</span> <span class="gmail-o">=</span> <span class="gmail-n">PETSc</span><span class="gmail-p">.</span><span class="gmail-n">Viewer</span><span class="gmail-p">().</span><span class="gmail-n">createHDF5</span><span class="gmail-p">(</span><span class="gmail-n">file_name</span><span class="gmail-p">,</span> <span class="gmail-s">'r'</span><span class="gmail-p">,</span> <span class="gmail-n">COMM_WORLD</span><span class="gmail-p">)</span></span>
<span id="gmail-LC2" class="gmail-line" lang="python"><span class="gmail-n">q</span><span class="gmail-p">.</span><span class="gmail-n">load</span><span class="gmail-p">(</span><span class="gmail-n">viewer</span><span class="gmail-p">)</span></span>
<span id="gmail-LC3" class="gmail-line" lang="python"><span class="gmail-n">q</span><span class="gmail-p">.</span><span class="gmail-n">ghostUpdate</span><span class="gmail-p">(</span><span class="gmail-n">addv</span><span class="gmail-o">=</span><span class="gmail-n">PETSc</span><span class="gmail-p">.</span><span class="gmail-n">InsertMode</span><span class="gmail-p">.</span><span class="gmail-n">INSERT</span><span class="gmail-p">,</span> <span class="gmail-n">mode</span><span class="gmail-o">=</span><span class="gmail-n">PETSc</span><span class="gmail-p">.</span><span class="gmail-n">ScatterMode</span><span class="gmail-p">.</span><span class="gmail-n">FORWARD</span><span class="gmail-p">)</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 class="gmail-code gmail-highlight" lang="shell"><span id="gmail-LC1" class="gmail-line" lang="shell"> File <span class="gmail-s2">"/home/shared/code.py"</span>, line 121, <span class="gmail-k">in </span>Load</span>
<span id="gmail-LC2" class="gmail-line" lang="shell"> viewer <span class="gmail-o">=</span> PETSc.Viewer<span class="gmail-o">()</span>.createHDF5<span class="gmail-o">(</span>file_name, <span class="gmail-s1">'r'</span>, COMM_WORLD<span class="gmail-o">)</span></span>
<span id="gmail-LC3" class="gmail-line" lang="shell"> File <span class="gmail-s2">"PETSc/Viewer.pyx"</span>, line 182, <span class="gmail-k">in </span>petsc4py.PETSc.Viewer.createHDF5</span>
<span id="gmail-LC4" class="gmail-line" lang="shell">petsc4py.PETSc.Error: error code 86</span>
<span id="gmail-LC5" class="gmail-line" lang="shell"><span class="gmail-o">[</span>0] PetscViewerSetType<span class="gmail-o">()</span> at /usr/local/petsc/src/sys/classes/viewer/interface/viewreg.c:442</span>
<span id="gmail-LC6" class="gmail-line" lang="shell"><span class="gmail-o">[</span>0] Unknown type. Check <span class="gmail-k">for </span>miss-spelling or missing package: <a href="https://petsc.org/release/install/install/#external-packages">https://petsc.org/release/install/install/#external-packages</a></span>
<span id="gmail-LC7" class="gmail-line" lang="shell"><span class="gmail-o">[</span>0] Unknown PetscViewer <span class="gmail-nb">type </span>given: hdf5</span>
</pre></blockquote><br><div>I have petsc4py 3.16 from <a href="https://hub.docker.com/r/dolfinx/dolfinx">this docker container</a> (<a href="https://docs.fenicsproject.org/dolfinx/main/python/installation.html#dependencies">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>