Debian Codegraph @

docs/backends/h5py.rst

raw
1 .. _h5pybackend:
2
3 H5PY-backend
4 -------------
5
6 The H5PY-backend relies on an MPI compatible build of :code:`HDF5`, which should be linked to the same MPI
7 implementation as DOLFINx relies on.
8
9 The DOLFINx docker images (:code:`ghcr.io/fenics/dolfinx/dolfinx:stable`) comes with an already configures MPI compatible HDF5 installation, and `h5py` can in
10 turn be installed with
11
12 .. code-block:: bash
13
14 HDF5_MPI="ON" HDF5_DIR="/usr/local" python3 -m pip install --no-binary=h5py h5py --no-build-isolation
15
16 If you are using `apt` on Ubuntu, this can for instance be achieved with the following commands (here using Docker).
17 Note that this code block does not install DOLFINx, it just illustrates how to get the correct `h5py`.
18
19 .. code-block:: dockerfile
20
21 FROM ubuntu:24.04 AS base
22 RUN apt-get update && apt-get install -y python3-dev python3-pip python3-venv libhdf5-mpi-dev libopenmpi-dev
23
24
25 ENV VIRTUAL_ENV=/test-env
26 ENV PATH=/test-env/bin:$PATH
27 RUN python3 -m venv ${VIRTUAL_ENV}
28
29 ENV HDF5_MPI="ON"
30 ENV HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/openmpi/
31 ENV C_PATH=/usr/lib/x86_64-linux-gnu/openmpi/include/:${C_PATH}
32 RUN python3 -m pip install setuptools cython numpy pkgconfig mpi4py
33 RUN CC=mpicc python3 -m pip install --no-binary=h5py h5py --no-build-isolation
34
35 .. automodule:: io4dolfinx.backends.h5py.backend
36 :members:
37 :exclude-members: read_point_data