Skip to content

A GEMSEO plugin to provide a PETSc wrapper for LinearSolver and MDA, this is not the MPI approach. This is a MIRROR of our gitlab repository, the development activity and support happen over there.

License

Notifications You must be signed in to change notification settings

gemseo/gemseo-petsc

Repository files navigation

gemseo-petsc

PyPI - License PyPI - Python Version PyPI Codecov branch

Overview

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.

Installation

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:

Linux environment

Using Conda

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 petsc4py

Using pip

PETSc 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 petsc4py

By building PETSc and petsc4py from sources

It 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

Bugs and questions

Please use the gitlab issue tracker to submit bugs or questions.

Contributing

See the contributing section of GEMSEO.

Contributors

  • François Gallard
  • Jean-Christophe Giret
  • Antoine Dechaume

Building petsc4py

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/

About

A GEMSEO plugin to provide a PETSc wrapper for LinearSolver and MDA, this is not the MPI approach. This is a MIRROR of our gitlab repository, the development activity and support happen over there.

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •