Python bindings for MPI
Project description
This package provides Python bindings for the Message Passing Interface (MPI) standard. It is implemented on top of the MPI specification and exposes an API which grounds on the standard MPI-2 C++ bindings.
Features
This package supports:
Convenient communication of any picklable Python object
point-to-point (send & receive)
collective (broadcast, scatter & gather, reductions)
Fast communication of Python object exposing the Python buffer interface (NumPy arrays, builtin bytes/string/array objects)
point-to-point (blocking/nonblocking/persistent send & receive)
collective (broadcast, block/vector scatter & gather, reductions)
Process groups and communication domains
Creation of new intra/inter communicators
Cartesian & graph topologies
Parallel input/output:
read & write
blocking/nonblocking & collective/noncollective
individual/shared file pointers & explicit offset
Dynamic process management
spawn & spawn multiple
accept/connect
name publishing & lookup
One-sided operations
remote memory access (put, get, accumulate)
passive target synchronization (start/complete & post/wait)
active target synchronization (lock & unlock)
Install
Using pip
You can install the latest mpi4py release from its source distribution at PyPI using pip:
$ python -m pip install mpi4py
You can also install the in-development version with:
$ python -m pip install git+https://github.com/mpi4py/mpi4py
or:
$ python -m pip install https://github.com/mpi4py/mpi4py/tarball/master
Using conda
The conda-forge community provides ready-to-use binary packages from an ever growing collection of software libraries built around the multi-platform conda package manager. Four MPI implementations are available on conda-forge: Open MPI (Linux and macOS), MPICH (Linux and macOS), Intel MPI (Linux and Windows) and Microsoft MPI (Windows). You can install mpi4py and your preferred MPI implementation using the conda package manager:
to use MPICH do:
$ conda install -c conda-forge mpi4py mpich
to use Open MPI do:
$ conda install -c conda-forge mpi4py openmpi
to use Intel MPI do:
$ conda install -c conda-forge mpi4py impi_rt
to use Microsoft MPI do:
$ conda install -c conda-forge mpi4py msmpi
MPICH and many of its derivatives are ABI-compatible. You can provide the package specification mpich=X.Y.*=external_* (where X and Y are the major and minor version numbers) to request the conda package manager to use system-provided MPICH (or derivative) libraries. Similarly, you can provide the package specification openmpi=X.Y.*=external_* to use system-provided Open MPI libraries.
The openmpi package on conda-forge has built-in CUDA support, but it is disabled by default. To enable it, follow the instruction outlined during conda install. Additionally, UCX support is also available once the ucx package is installed.
Linux
On Fedora Linux systems (as well as RHEL and their derivatives using the EPEL software repository), you can install binary packages with the system package manager:
using dnf and the mpich package:
$ sudo dnf install python3-mpi4py-mpich
using dnf and the openmpi package:
$ sudo dnf install python3-mpi4py-openmpi
Please remember to load the correct MPI module for your chosen MPI implementation:
for the mpich package do:
$ module load mpi/mpich-$(arch) $ python -c "from mpi4py import MPI"
for the openmpi package do:
$ module load mpi/openmpi-$(arch) $ python -c "from mpi4py import MPI"
On Ubuntu Linux and Debian Linux systems, binary packages are available for installation using the system package manager:
$ sudo apt install python3-mpi4py
Note that on Ubuntu/Debian systems, the mpi4py package uses Open MPI. To use MPICH, install the libmpich-dev and python3-dev packages (and any other required development tools). Afterwards, install mpi4py from sources using pip.
macOS
macOS users can install mpi4py using the Homebrew package manager:
$ brew install mpi4py
Note that the Homebrew mpi4py package uses Open MPI. Alternatively, install the mpich package and next install mpi4py from sources using pip.
Windows
Windows users can install mpi4py from binary wheels hosted on the Python Package Index (PyPI) using pip:
$ python -m pip install mpi4py
The Windows wheels available on PyPI are specially crafted to work with either the Intel MPI or the Microsoft MPI runtime, therefore requiring a separate installation of any one of these packages.
Intel MPI is under active development and supports recent version of the MPI standard. Intel MPI can be installed with pip (see the impi-rt package on PyPI), being therefore straightforward to get it up and running within a Python environment. Intel MPI can also be installed system-wide as part of the Intel HPC Toolkit for Windows or via standalone online/offline installers.
Citation
If MPI for Python been significant to a project that leads to an academic publication, please acknowledge that fact by citing the project.
M. Rogowski, S. Aseeri, D. Keyes, and L. Dalcin, mpi4py.futures: MPI-Based Asynchronous Task Execution for Python, IEEE Transactions on Parallel and Distributed Systems, 34(2):611-622, 2023. https://doi.org/10.1109/TPDS.2022.3225481
L. Dalcin and Y.-L. L. Fang, mpi4py: Status Update After 12 Years of Development, Computing in Science & Engineering, 23(4):47-54, 2021. https://doi.org/10.1109/MCSE.2021.3083216
L. Dalcin, P. Kler, R. Paz, and A. Cosimo, Parallel Distributed Computing using Python, Advances in Water Resources, 34(9):1124-1139, 2011. https://doi.org/10.1016/j.advwatres.2011.04.013
L. Dalcin, R. Paz, M. Storti, and J. D’Elia, MPI for Python: performance improvements and MPI-2 extensions, Journal of Parallel and Distributed Computing, 68(5):655-662, 2008. https://doi.org/10.1016/j.jpdc.2007.09.005
L. Dalcin, R. Paz, and M. Storti, MPI for Python, Journal of Parallel and Distributed Computing, 65(9):1108-1115, 2005. https://doi.org/10.1016/j.jpdc.2005.03.010
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for mpi4py-4.0.0-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a7a81c58215a4bb22435b38755f577d4c25d25435144801d9a4ac1cb4ea1857 |
|
MD5 | 9ffc54b5bf5a371b4a57e057fc4f81ef |
|
BLAKE2b-256 | b3673038b8d6792f226a3af44cc6606bbb3a1bb92a408a912bdc347662f92e06 |
Hashes for mpi4py-4.0.0-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae25e4180d0a41eaab12d0c35c8e4324631de03925208d1bdbdf48399c0a922f |
|
MD5 | 37f4509fc3f15b2dcb575b4dcec952da |
|
BLAKE2b-256 | 6af3e2ac593725ebd2341dc2b0da7069864fd2779969320a00ab3afdc1dc218c |
Hashes for mpi4py-4.0.0-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8186de3b98b07596fbc807f447ce973647d19b611463a6b84017e716db5c5bce |
|
MD5 | 1cfef953b7038d22ea6ce17657d71755 |
|
BLAKE2b-256 | e48ce0c01e80cb785fbdb93d685a59f5b0a0eb1d470ebc1f9be0334678fad195 |
Hashes for mpi4py-4.0.0-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e6b917e30095150add80fa4875c1ed2769badfc76487f7f0da566d24a56bdb1 |
|
MD5 | 531b84c05464cf9e0624e08299fd3215 |
|
BLAKE2b-256 | eec279cd95134525030c0b3f60bb269baab3630884a5718f13a0c47af7a2f4c6 |
Hashes for mpi4py-4.0.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92b66a24fc932a1ee96e4830d71ca07de2835529df9f6b26044703b83cd86800 |
|
MD5 | 57370c55e5300b6f2723b372c3267548 |
|
BLAKE2b-256 | 42f765ba19bb88e94775b136fb559d02c4243ba776812ba9113b6fb770a808a3 |
Hashes for mpi4py-4.0.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03ecab5c3699ebd4a8a88acafb72d00c1cc7d3bfc466f0b9343b426d210cddb8 |
|
MD5 | 5e1d669a3bc5a2f397b9e29512fa005e |
|
BLAKE2b-256 | cccfbf6ce6991fc5699b8dc72003d2913893412a581a3dac9617f0f2bca1e6bf |
Hashes for mpi4py-4.0.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21201224ec5a7ad158ab8cddc7a8d12f4de678f0f2f90ad855ac6216ee41fba2 |
|
MD5 | 5f9764ffc24d9b39343a2615f7c225ae |
|
BLAKE2b-256 | 5f867a3e4254df142079285a0e7eb8267f57580549b7e2131e4be4ff4b27faa1 |
Hashes for mpi4py-4.0.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 233448865a994195ce5f4d1c858dccedf50a53e4e3b0046383a59b185ddfe4e0 |
|
MD5 | 743ed860b0c13d9193b08a1ff8f07a7b |
|
BLAKE2b-256 | 757aa3288b1d54d61304f0a2369f303433dfa28b0aadfe550c40e0cb5fab6b5b |
Hashes for mpi4py-4.0.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0406ac9923ce18742b7cec3f9138d5d92ba5d5b45adb1744e53ed825e3bc124f |
|
MD5 | 986abc6b76dc7f63b2ce0fd5b5a9d7ef |
|
BLAKE2b-256 | 25b1440e3f428a82cac6f77936f5dcd76c970056dca74e1a239e007f62f279a7 |
Hashes for mpi4py-4.0.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33e05e781bae9aceee4c63e398e6e309ea0a2b0d0f1f1bba58dbe13bce128f5f |
|
MD5 | d00931afefacd0b6600ac404a87510e1 |
|
BLAKE2b-256 | 3d155e6045d23c8ec8f89406ca30432fe65c75d8eac495994ddb030ced15def3 |
Hashes for mpi4py-4.0.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b950e304e99f84db03dfc889c150ad9f98c892eb0ece11df2d860b8a2103a9d |
|
MD5 | 6141f87196e7c6971aa07cc3ca675e38 |
|
BLAKE2b-256 | de56d8ebdc6a7a6a4ff37d716417df931d5eb198547640f7073da0507146ade0 |