Skip to content

Experimental binary wheel builder - #4042

Merged
jhale merged 95 commits into
mainfrom
jhale/wheel-experiment
Jan 25, 2026
Merged

Experimental binary wheel builder#4042
jhale merged 95 commits into
mainfrom
jhale/wheel-experiment

Conversation

@jhale

@jhale jhale commented Jan 21, 2026

Copy link
Copy Markdown
Member

This introduces the capability to build relocatable DOLFINx ABI3 binary wheels for Python >= 3.12 without PETSc/petsc4py.

An MPICH-compatible MPI implementation must be installed on the system. ABI compatibility initiative will eventually remove this limitation allowing OpenMPI to be used as well.

I will post a test set of packages with instructions here in due course.

@jhale

jhale commented Jan 22, 2026

Copy link
Copy Markdown
Member Author

gdb --args python -m pytest -k test_write_point_data python/test/unit/io/test_vtkhdf.py

#0  0x0000ffff8edd7d40 in ?? () from /lib/aarch64-linux-gnu/libc.so.6
#1  0x0000ffff8ed86900 [PAC] in raise () from /lib/aarch64-linux-gnu/libc.so.6
#2  0x0000ffff8ed71a44 [PAC] in abort () from /lib/aarch64-linux-gnu/libc.so.6
#3  0x0000ffff80e50984 [PAC] in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) ()
   from /usr/local/lib/python3.13/site-packages/dolfinx/../fenics_dolfinx.libs/libdolfinx-e9eb1af4.so.0.11.0.0
#4  0x0000ffff81512f98 in std::vector<unsigned long long, std::allocator<unsigned long long> >::operator[] (this=0xffffd0750bb0, __n=1)
    at /opt/rh/gcc-toolset-14/root/usr/include/c++/14/bits/stl_vector.h:1149
#5  0x0000ffff815162b8 in dolfinx::io::hdf5::write_dataset<int> (file_handle=72057594037927937, dataset_path="/VTKHDF/Steps/CellOffsets", data=0xffffd0750d7c, range=...,
    global_size=std::vector of length 1, capacity 1 = {...}, use_mpi_io=true, use_chunking=true) at /usr/local/include/dolfinx/io/HDF5Interface.h:201
#6  0x0000ffff81505a70 in dolfinx::io::VTKHDF::write_data<float>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, dolfinx::mesh::Mesh<float> const&, std::vector<float, std::allocator<float> > const&, double)::{lambda<typename $T0>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, $T0)#1}::operator()<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) const (__closure=0xffffd0750ef0, dset_name="/VTKHDF/Steps/CellOffsets", value=0) at /usr/local/include/dolfinx/io/VTKHDF.h:236
#7  0x0000ffff815062f8 in dolfinx::io::VTKHDF::write_data<float> (point_or_cell="Point", filename="point_data.vtkhdf", mesh=...,
    data=std::vector of length 36, capacity 36 = {...}, time=0) at /usr/local/include/dolfinx/io/VTKHDF.h:241

Looks like an issue in DOLFINx (or the test) triggering a standard library assert.

@pytest.mark.parametrize("dtype", [np.float32, np.float64])
def test_write_point_data(dtype):
    mesh = create_unit_square(MPI.COMM_WORLD, 5, 5, dtype=dtype)
    filename = "point_data.vtkhdf"
    write_mesh(filename, mesh)
    point_data = np.arange(mesh.geometry.index_map().size_local)
    for j in range(3):
        write_point_data(filename, mesh, point_data, float(j))

@jhale

jhale commented Jan 22, 2026

Copy link
Copy Markdown
Member Author

I now have a partial test suite pass with these wheels using:

mpiexec -n 3 python -m pytest -v -k "not write_cell_data and not write_point_data and not write_mixed_topology_data" -m "not petsc4py and not adios2" python/test/unit/

@jhale

jhale commented Jan 23, 2026

Copy link
Copy Markdown
Member Author

This is now fully tested, e.g. pip install mpich fenics-dolfinx works.

https://github.com/FEniCS/dolfinx/actions/runs/21290820557/job/61283653443

A single binary wheel is compatible for all Python versions >= 3.12 and with any MPICH-compatible MPI; we're testing MPICH and Intel MPI wheels and system-provided MPICH. This is technically possible thanks to some nice work done recently in mpi4py.

When MPI5 is standardised and implemented it will be possible to provide a single wheel for all MPI5 ABI-compliant implementations.

It should be relatively straightforward to build wheels for macOS, and even Windows, as Intel provide impi-rt wheels there.

In terms of solvers, as we do not build against PETSc, an interface to MUMPS for our own MatrixCSR class would be a big quality of life improvement, and good enough for most users to get started with.

@jhale
jhale added this pull request to the merge queue Jan 25, 2026
Merged via the queue into main with commit b7ecdef Jan 25, 2026
21 checks passed
@jhale
jhale deleted the jhale/wheel-experiment branch January 25, 2026 10:32
@awensaunders

Copy link
Copy Markdown

Hi there, I know this PR is closed & merged now - is there any intention of uploading these wheels to pypi so those of us using non-conda package managers such as uv can just grab a wheel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants