<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> Something is really wrong with the process, you should not have to waste all this time on a simple build that in theory is super simple given it is using docker. <div class=""><br class=""></div><div class=""> We debug these things by looking at the output files from PETSc: configure.log make.log and the output from make check. Are these files available when you do the docker install business? Without these files we are in the dark just completely guessing what is happening. If the docker is using a prebuilt PETSc inside iteself then there is no way to add hdf5 after the fact.</div><div class=""><br class=""></div><div class=""> Barry</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 7, 2021, at 11:15 AM, Quentin Chevalier <<a href="mailto:quentin.chevalier@polytechnique.edu" class="">quentin.chevalier@polytechnique.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">@Lawrence, thanks for the details, but point 7 fails with : <br class="">
</div><div class=""><br class=""></div><div class="">ERROR: Invalid requirement: '/usr/local/petsc/src/binding/petsc4py'<br class="">
Hint: It looks like a path. File
'/usr/local/petsc/src/binding/petsc4py' does not exist.</div><div class=""><br class=""></div><div class="">Just like @wence's tentative command. I've changed the dockerfile of dolfinx to add the --with-hdf5 flag and I'm trying to build a new optimised docker image with :</div><br class="">echo '{ "cffi_extra_compile_args" : ["-O2", "-march=native" ] }' > dolfinx_jit_parameters.json<br class=""><div class="">docker build --target dolfinx --file Dockerfile --build-arg PETSC_SLEPC_OPTFLAGS="-O2 -march=native" --build-arg DOLFINX_CMAKE_CXX_FLAGS="-march=native" .</div><div class=""><br class=""></div><div class="">It's slowgoing, but it might eventually do the trick I guess.<br class=""></div><div class=""><br class=""></div><div class="">@bsmith, the --with-petsc4py flag changes nothing.</div> <br class=""><div class="">MWE is unchanged :<br class=""></div><span class="gmail-im"><div class="">* Run<a href="https://hub.docker.com/r/dolfinx/dolfinx" target="_blank" class=""> this docker container</a><br class="">* Do : python3 -c "from petsc4py import PETSc; PETSc.Viewer().createHDF5('dummy.h5')"<br class=""><br class=""></div></span><div class="">Updated attempt at a fix :<br class=""></div><div class="">* cd /usr/local/petsc/<br class="">* ./configure --with-hdf5 --with-petsc4py --force (turns out the container sets PETSC_ARCH and PETSC_DIR as environment variables by default)<br class="">* make all</div><div class=""><br class=""></div><div class="">This still produces the same error :<br class=""></div><div class=""><br class=""></div><div class="">Traceback (most recent call last):<br class=""> File "<string>", line 1, in <module><br class=""> File "PETSc/Viewer.pyx", line 182, in petsc4py.PETSc.Viewer.createHDF5<br class="">petsc4py.PETSc.Error: error code 86<br class="">[0] PetscViewerSetType() at /usr/local/petsc/src/sys/classes/viewer/interface/viewreg.c:442<br class="">[0] Unknown type. Check for miss-spelling or missing package: <a href="https://petsc.org/release/install/install/#external-packages" class="">https://petsc.org/release/install/install/#external-packages</a><br class="">[0] Unknown PetscViewer type given: hdf5<br class=""></div><div class=""><br class=""></div>Quentin<br class=""><br class=""></div><br clear="all" class=""><div class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><span style="font-family: Arial, sans-serif;" class=""> </span>
<div class="">
<table style="width:369pt;margin-left:5.4pt;border-collapse:collapse" width="0" cellspacing="0" cellpadding="0" border="0" class="">
<tbody class="">
<tr style="height:63pt" class="">
<td style="width:57.75pt;border-color:windowtext currentcolor currentcolor;border-style:solid none none;border-width:1.5pt medium medium;padding:0cm 5.4pt;height:63pt" width="77" valign="top" class=""><p class="MsoNormal" style="margin-top:6pt;text-align:center" align="center"><span style="font-size:11pt;font-family:"Calibri",sans-serif;color:rgb(31,73,125)" class=""><img style="width: 0.427in; height: 1in;" src="cid:image003.jpg@01D690CB.3B3FDC10" alt="cid:image003.jpg@01D690CB.3B3FDC10" width="41" height="96" class=""></span></p>
</td>
<td style="width:311.25pt;border-style:solid none none;border-width:1.5pt medium medium;padding:0cm 5.4pt;height:63pt;border-color:currentcolor" width="415" valign="top" class=""><p class="MsoNormal" style="margin-right:0cm;margin-left:0.85pt;margin-bottom:0.0001pt;line-height:12pt;break-after:avoid">
<span style="font-size:11pt;font-family:"Berlin Sans FB",sans-serif;color:rgb(127,127,127)" class="">Quentin CHEVALIER – IA parcours recherche</span></p><p class="MsoNormal" style="margin-left:0.9pt;line-height:12pt;break-after:avoid">
<span style="font-size:11pt;font-family:"Berlin Sans FB",sans-serif;color:rgb(127,127,127)" class="">LadHyX - Ecole polytechnique</span></p><p class="MsoNormal" style="margin-left:0.9pt;line-height:12pt;break-after:avoid">
<span style="font-size:11pt;font-family:"Berlin Sans FB",sans-serif;color:rgb(127,127,127)" class="">__________</span></p></td></tr></tbody></table></div></div></div></div><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 7 Dec 2021 at 16:52, Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class=""><div class=""><br class=""></div> You can also just add --with-petsc4py to your PETSc configure command and it will manage automatically the petsc4py install. So<div class=""><br class=""></div><div class=""><span style="font-size:13px" class="">./configure --with-hdf5 --any-other --configure-flags --you-want --with-petsc4py</span></div><div class=""><font size="2" class=""><br class=""></font></div><div class=""><font size="2" class=""><br class=""></font><div class=""> Some people don't like this approach, I don't understand exactly why not; it should be equivalent (if it is not equivalent then perhaps it could be fixed?).</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Dec 7, 2021, at 10:18 AM, Lawrence Mitchell <<a href="mailto:wence@gmx.li" target="_blank" class="">wence@gmx.li</a>> wrote:</div><br class=""><div class=""><div class="">Comments inline below:<br class=""><br class=""><blockquote type="cite" class="">On 7 Dec 2021, at 14:43, Quentin Chevalier <<a href="mailto:quentin.chevalier@polytechnique.edu" target="_blank" class="">quentin.chevalier@polytechnique.edu</a>> wrote:<br class=""><br class="">@Matthew, as stated before, error output is unchanged, i.e.the python<br class="">command below produces the same traceback :<br class=""><br class=""># python3 -c "from petsc4py import PETSc; PETSc.Viewer().createHDF5('d.h5')"<br class="">Traceback (most recent call last):<br class=""> File "<string>", line 1, in <module><br class=""> File "PETSc/Viewer.pyx", line 182, in petsc4py.PETSc.Viewer.createHDF5<br class="">petsc4py.PETSc.Error: error code 86<br class="">[0] PetscViewerSetType() at<br class="">/usr/local/petsc/src/sys/classes/viewer/interface/viewreg.c:442<br class="">[0] Unknown type. Check for miss-spelling or missing package:<br class=""><a href="https://petsc.org/release/install/install/#external-packages" target="_blank" class="">https://petsc.org/release/install/install/#external-packages</a><br class="">[0] Unknown PetscViewer type given: hdf5<br class=""><br class="">@Wence that makes sense. I'd assumed that the original PETSc had been<br class="">overwritten, and if the linking has gone wrong I'm surprised anything<br class="">happens with petsc4py at all.<br class=""><br class="">Your tentative command gave :<br class=""><br class="">ERROR: Invalid requirement: '/usr/local/petsc/src/binding/petsc4py'<br class="">Hint: It looks like a path. File<br class="">'/usr/local/petsc/src/binding/petsc4py' does not exist.<br class=""><br class="">So I tested that global variables PETSC_ARCH & PETSC_DIR were correct<br class="">then ran "pip install petsc4py" to restart petsc4py from scratch.<br class=""></blockquote><br class="">This downloads petsc4py from pypi. It is not guaranteed to give you a version that matches the PETSc version you have installed (which is the source of your error below)<br class=""><br class=""><br class=""><blockquote type="cite" class="">This<br class="">gives rise to a different error :<br class=""><br class=""></blockquote>[...]<br class=""><blockquote type="cite" class="">ImportError: /usr/local/lib/python3.9/dist-packages/petsc4py/lib/linux-gnu-real-32/<a href="http://petsc.cpython-39-x86_64-linux-gnu.so/" target="_blank" class="">PETSc.cpython-39-x86_64-linux-gnu.so</a>:<br class="">undefined symbol: petscstack<br class=""><br class="">Not sure that it a step forward ; looks like petsc4py is broken now.<br class=""></blockquote><br class="">The steps to build PETSc with HDF5 support and then get a compatible petsc4py are:<br class=""><br class="">1. Download the PETSc source somehow (<a href="https://petsc.org/release/download/" target="_blank" class="">https://petsc.org/release/download/</a>)<br class=""><br class="">I now assume that this source tree lives in .../petsc<br class=""><br class="">2. cd .../petsc<br class=""><br class="">3. ./configure --with-hdf5 --any-other --configure-flags --you-want<br class=""><br class="">4. Run the appropriate "make" command as suggested by configure<br class=""><br class="">5. Run the appropriate "make check" command as suggested by configure<br class=""><br class="">6. Set PETSC_DIR and PETSC_ARCH appropriately<br class=""><br class="">7. pip install src/binding/petsc4py<br class=""><br class="">If you are working the docker container from dolfinx/dolfinx, you can see the commands that are run to install PETSc, and then petsc4py, here <a href="https://github.com/FEniCS/dolfinx/blob/main/docker/Dockerfile#L243" target="_blank" class="">https://github.com/FEniCS/dolfinx/blob/main/docker/Dockerfile#L243</a><br class=""><br class="">If you want to reproduce these versions of PETSc but with the addition of HDF5 support, just add --with-hdf5 to all of the relevant configure lines.<br class=""><br class="">Lawrence<br class=""><br class=""><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div>
<span id="cid:%3C%3E"><image003.jpg></span></div></blockquote></div><br class=""></div></body></html>