PETSc GEMSEO interface.
This plugin provides an interface to the PETSc linear solvers and Ordinary Differential Equations (ODE) solvers. Linear solvers can be used for direct and adjoint linear system resolution in GEMSEO. The ODE solver provides the computation of the adjoints with respect to the initial conditions of the ODE and with respect to the design variables.
gemseo-petsc relies on petsc4py, the Python bindings for PETSc. PETSc and petsc4py are available on pypi, but no wheel are available. Hence, depending on the initial situation, here are our recommendations:
PETSc and petsc4py are available on the conda-forge repository. If you start from scratch of if you want to install the plugin in a pre-existing conda environment, you can use the following command in your current conda environment before installing gemseo-petsc:
conda install -c conda-forge petsc4pyPETSc and petsc4py can be build from their sources by using pip. To do so, use the following commands in your Python environment.
pip install petsc petsc4pyIt is also possible to build PETSc and petsc4py from the PETSc sources. To do so, please follow the information provided in the PETSc installation manual, and do not forget to enable the compilation of petsc4py.
Although it has not be tested, it is possible to build PETSc and petsc4py under a Windows environment, and hence to have the gemseo-petsc plugin working. A description of the procedure to build these dependencies can be found here
Please use the gitlab issue tracker to submit bugs or questions.
See the contributing section of GEMSEO.
- François Gallard
- Jean-Christophe Giret
- Antoine Dechaume
From the container
registry.gitlab.com/gemseo/dev/gemseo-petsc/multi-python-petsc,
get the sources of petsc4py corresponding to the version of petsc
currently installed in the system (currently 3.20.5).
Install the following dependencies with dnf:
- redhat-rpm-config
- python3.13-devel
- hdf5-devel
then export NUMPY_INCLUDE=<path to numpy includes>
then
PETSC_DIR=$(pwd)/petsc-includes uv build --wheel -p python3.13 .
where petsc-includes contains the symbolic links to:
- include -> /usr/include/petsc/
- lib -> lib64/
- lib64 -> /usr/lib64/