Installation
Create and activate a Python environment:
python -m venv envsource env/bin/activatepip install --upgrade pipInstall the release from PyPI, where the package is called patchwork-amr (patchwork there
is an unrelated project); the import is import patchwork:
pip install patchwork-amrOr install the package and its requirements from a clone with pip:
pip install -e .Run the code with:
patchworkOptional extras
Section titled “Optional extras”| Extra | Installs |
|---|---|
mpi | mpi4py, for runs under mpiexec |
petsc | petsc4py, for NodalPoisson(backend="petsc"): the solve distributed over the ranks |
pyccel | Pyccel, which compiles the kernels (locate) on their first call; without it their NumPy versions run |
test | pytest, coverage and the pyccel extra |
docs | the notebook runner and griffe for the API reference |
dev | formatters and linters, plus the test and docs extras |
pip install -e ".[dev]"Optional plotting tools
Section titled “Optional plotting tools”Install Matplotlib with Patchwork when you want to use plot_patches or run the
examples that save figures. SciPy, used by the composite Poisson solver, is installed
as a core dependency:
pip install -e ".[plot]"For multi-rank runs, install the optional MPI bindings too:
pip install -e ".[mpi,plot]"mpiarray uses its serial communicator when MPI is not installed or no MPI
launcher is active. The AMR examples therefore run as ordinary Python scripts.