Introduction
PyMGRIT is a package for the Multigrid-Reduction-in-Time (MGRIT) algorithm in Python.
PyMGRIT is currently developed by Jens Hahne and Stephanie Friedhoff.
What is MGRIT?
The MGRIT algorithm is a reduction-based time-multigrid method for solving time-dependent problems. In contrast to solving sequentially for one time step after the other, the MGRIT algorithm is an iterative method that allows calculating multiple time steps simultaneously by using a time-grid hierarchy. The MGRIT method is a non-intrusive approach that essentially uses the same time integrator as a traditional time-stepping algorithm. Therefore, it is particularly well suited for introducing time parallelism in simulations using existing application codes.
PyMGRIT Features
PyMGRIT features:
Classical Multigrid-Reduction-in-Time (MGRIT) for solving evolutionary systems of equations
Non-intrusive approach
Optimal time-multigrid algorithm
A variety of cycling strategies, relaxation schemes, and coarsening strategies
Time parallelism
Specific to space-time problems
Space & time parallelism
Additional coarsening in space
Citing
@MISC{PyMGRIT,
author = "Hahne, J. and Friedhoff, S.",
title = "{PyMGRIT}: Multigrid-Reduction-in-Time in {Python} v1.0",
year = "2020",
url = "https://github.com/pymgrit/pymgrit",
note = "Release 1.0"
}
Installation
PyMGRIT requires mpicc (from openmpi or mpich)
>>> pip3 install pymgrit
or
>>> git clone https://github.com/pymgrit/pymgrit.git >>> cd pymgrit >>> pip3 install .
Example Usage
PyMGRIT is easy to use! The following code generates a discrete Dahlquist test problem and solves the resulting linear system using a two-level MGRIT algorithm.:
# Import PyMGRIT from pymgrit import * # Create Dahlquist's test problem with 101 time steps in the interval [0, 5] dahlquist = Dahlquist(t_start=0, t_stop=5, nt=101) # Construct a two-level multigrid hierarchy for the test problem using a coarsening factor of 2 dahlquist_multilevel_structure = simple_setup_problem(problem=dahlquist, level=2, coarsening=2) # Set up the MGRIT solver for the test problem and set the solver tolerance to 1e-10 mgrit = Mgrit(problem=dahlquist_multilevel_structure, tol=1e-10) # Solve the test problem info = mgrit.solve()
Program output:
INFO - 21-02-20 16:18:43 - Start setup INFO - 21-02-20 16:18:43 - Setup took 0.009232759475708008 s INFO - 21-02-20 16:18:43 - Start solve INFO - 21-02-20 16:18:43 - iter 1 | conv: 7.186185937031941e-05 | conv factor: - | runtime: 0.013237237930297852 s INFO - 21-02-20 16:18:43 - iter 2 | conv: 1.2461067076355103e-06 | conv factor: 0.017340307063501627 | runtime: 0.010195493698120117 s INFO - 21-02-20 16:18:43 - iter 3 | conv: 2.1015566145245807e-08 | conv factor: 0.016864981158092696 | runtime: 0.008922338485717773 s INFO - 21-02-20 16:18:43 - iter 4 | conv: 3.144127445017594e-10 | conv factor: 0.014960945726074891 | runtime: 0.0062139034271240234 s INFO - 21-02-20 16:18:43 - iter 5 | conv: 3.975214076032893e-12 | conv factor: 0.01264329816633959 | runtime: 0.006150722503662109 s INFO - 21-02-20 16:18:43 - Solve took 0.05394101142883301 s INFO - 21-02-20 16:18:43 - Run parameter overview time interval : [0.0, 5.0] number of time points : 101 max dt : 0.05000000000000071 number of levels : 2 coarsening factors : [2] cf_iter : 1 nested iteration : True cycle type : V stopping tolerance : 1e-10 time communicator size : 1 space communicator size : 1
Getting Help
For documentation see https://pymgrit.github.io/pymgrit/
Create an issue.
Look at the Quickstart, Tutorial or the Examples.
Metadata
Release files for pymgrit 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pymgrit-1.0.6.tar.gz | 45.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymgrit-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 107.5 kB
Release files / pymgrit-1.0.6.tar.gz
| Download URL | pymgrit-1.0.6.tar.gz |
|---|---|
| Size | 45.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c58aa741a4840405c16c80509a8609b22655ef7763314e34438a398f1ce8b281
|
|
BLAKE2b-256 checksum How to use checksums |
70983b577eff74cd151ebcb9d8bf670ec361682967a2ec4848c9b8de559dc581
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Release files / pymgrit-1.0.6-py3-none-any.whl
| Download URL | pymgrit-1.0.6-py3-none-any.whl |
|---|---|
| Size | 61.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49e924152551a78efba2fd3931f487a55e75baa2f6b794188df57ff3767f665e
|
|
BLAKE2b-256 checksum How to use checksums |
60bfc98206c94bd3d5a7c64799a772983e80ac3b63737aefb4a8bf9da30c66d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Security for pymgrit 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.