This package provides a low level interface for PETSc and allows combining julia features (such as automatic differentiation) with the PETSc infrastructure and nonlinear solvers.
This package can be added with the julia command:
]add PETSc
The installation can be tested with
]test PETSc
By default, the package uses a pre-built binary of (see PETSc_jll) along with a default installation of MPI.jl
, so you don't have to install it on your machine.
If you want to use the package with custom builds of the PETSc library, this can be done by specifying the environment variable JULIA_PETSC_LIBRARY
. This is a colon separated list of paths to custom builds of PETSc; the reason for using multiple builds is to enable single, double, and complex numbers in the same julia session. These should be built against the same version of MPI as used with MPI.jl
After setting the variable you should
]build PETSc
and the library will be persistently set until the next time the build command is issued.
To see the currently set library use
using PETSc
PETSc.libs
The package currently does not work on windows, mainly because MicrosoftMPI_jll
does not function when used along with the precompiled version used in PETSc_jll
. Windows users are therefore advised to install the Windows Subsystem for Linux (WSL) and run PETSc through there.
The documentation is currently rather minimalistic; yet, if you want to see what is possible have a look at the examples directory or at the tests in the test directory. We do keep the tests up to date, so that is a good starting point.