Install dolfinx and petsc from wheels instead of building them - #19
Open
shimwell wants to merge 1 commit into
Open
Install dolfinx and petsc from wheels instead of building them#19shimwell wants to merge 1 commit into
shimwell wants to merge 1 commit into
Conversation
The pip install built petsc, basix and dolfinx from source, which took
the best part of an hour and needed fifteen apt packages to do it. All
of them are wheels now, so the script installs them.
pip install mpich
pip install --pre --extra-index-url https://shimwell.github.io/wheels \
"fenics-dolfinx[petsc4py]" petsc
That removes the petsc source build, the PETSC_DIR export, the symlink
that worked around petsc shipping libpetsc.so as a linker script, both
git clones, six cmake invocations, and thirteen of the fifteen apt
packages. What is left of apt is what cadquery and pyvista need to
render. The script goes from 80 lines to 36.
--pre is needed. These are development versions, and without it pip
ignores them and falls back to building petsc from the source
distribution, which is the slow path this replaces.
The wheels move dolfinx from 0.11.0 to 0.12.0.dev0. The scripts use
LinearProblem, fem, mesh and io.vtkhdf, and those all take the same
arguments in 0.12. Checked by installing from the index into a clean
python:3.12 container and running 2-solve-heat-equation.py, which
produced an identical 12141375 byte temperature.vtkhdf both serially
and under mpiexec -n 2.
CI no longer needs ubuntu-26.04. That pin was for a scotch new enough to
ship SCOTCHConfig.cmake, which only the source build wanted. The wheels
are manylinux_2_34, so glibc 2.34 is the floor and ubuntu-latest is
fine. The job timeout drops from 180 minutes to 30.
The petsc wheels are built Fortran free with SuperLU_DIST rather than
MUMPS, because the MPI wheels on PyPI ship no Fortran bindings, and they
are built from petsc main to pick up the fix that lets a prebuilt
petsc4py find libpetsc. That fix is in the 3.26 milestone, so they will
be rebuilt against the release when it lands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The pip install built petsc, basix and dolfinx from source, which took the best part of an hour and needed fifteen apt packages to do it. All of them are wheels now.
pip install mpich pip install --pre --extra-index-url https://shimwell.github.io/wheels \ "fenics-dolfinx[petsc4py]" petscinstallation-with-pip.shgoes from 80 lines to 36. Gone are the petsc source build, thePETSC_DIRexport, the symlink working around petsc shippinglibpetsc.soas a linker script, both git clones, six cmake invocations, and thirteen of the fifteen apt packages. What is left of apt is what cadquery and pyvista need to render.Checked, not assumed
Installed from the index into a clean
python:3.12container and ran2-solve-heat-equation.py. Identical output both ways.Nothing compiled during the install.
Worth knowing in review
dolfinx moves from 0.11.0 to 0.12.0.dev0. The scripts use
LinearProblem,fem,meshandio.vtkhdf, and those take the same arguments in 0.12. The run above is the evidence. It is a development version though, so it will move.--preis required. Without it pip ignores these versions and falls back to building petsc from the PyPI source distribution, which is the slow path this replaces. That failure is quiet, it looks like a normal slow install.The basix wheel works now. The old script built basix from source with a comment explaining that the fenics-basix wheel could not be used, because it is a
Py_LIMITED_APIbuild and nanobind puts that in its ABI tag, so its types were invisible to locally built dolfinx bindings. That is no longer a problem here since basix and dolfinx come from the same build and share a tag.No MPI clash. The petsc wheels are built against the PyPI mpich. The openmc wheel links no MPI at all, so the openmpi flavour matching the old script needed no longer applies.
CI drops to ubuntu-latest. The 26.04 pin was for a scotch new enough to ship
SCOTCHConfig.cmake, which only the source build wanted. The wheels aremanylinux_2_34, so glibc 2.34 is the floor, meaning Ubuntu 22.04 onwards. The job timeout goes from 180 minutes to 30.About the petsc wheels
They are custom builds from https://github.com/shimwell/wheels, not PyPI.
mainrather than a release, to pick up petsc!9573. Without it a prebuilt petsc4py records thePETSC_DIRof the machine that built it and dolfinx cannot findlibpetsc. That fix is in the 3.26 milestone, expected around the end of September, so these get rebuilt against the release when it lands.MPIX_Irecv_enqueue, which Intel MPI does not implement despite being MPICH ABI compatible.