Python Interface for the MUMPS Solver
MUMPS4PY is a Python wrapper for the MUltifrontal Massively Parallel Solver (MUMPS), enabling efficient sparse matrix computations with parallel processing. It provides a high-performance interface for solving sparse linear systems using MPI-based parallelism.
You can find more details, benchmarks, and examples in Benchmarks.
You can install mumps4py on Linux, MacOS, and Windows using conda/mamba:
conda install mumps4py
- Linux (Ubuntu): See instructions below.
- Windows: See docs/install_windows.md.
- macOS: See docs/install_macos.md.
- Docker: See docs/docker.md.
To use MUMPS4PY, you need:
- MUMPS (compiled with shared libraries)
- MPI (
mpichoropenmpi) - Python 3.5+
- NumPy, mpi4py, and SciPy
Note on MUMPS Installation:
- If you install MUMPS via apt (e.g., sudo apt install
libmumps-ptscotch-devas shown below), shared libraries are included, and you can follow this README directly. - If you download MUMPS from the official website (mumps-solver.org), you must build the shared libraries manually (e.g.,
libdmumps.so). See docs/build_shared_libs.md for instructions on building shared libraries from the MUMPS source. Do not forgot to export all MUMPS library dependencies (eg.libpord.so,libmetis.so, etc).
- If you install MUMPS via apt (e.g., sudo apt install
sudo apt install libmumps-ptscotch-dev| Variable | Description |
|---|---|
| MUMPS_INC | Path to the MUMPS include directory (e.g., dmumps_c.h) |
| MUMPS_LIB | Path to the MUMPS library directory (e.g., libdmumps.so) |
| MUMPS_SOLVERS | Specify which MUMPS solver to use (dmumps, cmumps, smumps, zmumps) |
export MUMPS_INC="/path/to/MUMPS/include"
export MUMPS_LIB="/path/to/MUMPS/lib"
export MUMPS_SOLVERS="dmumps"export MUMPS_SOLVERS="dmumps,cmumps,zmumps,smumps"echo 'export MUMPS_INC="/path/to/MUMPS/include"' >> ~/.bashrc
echo 'export MUMPS_LIB="/path/to/MUMPS/lib"' >> ~/.bashrc
echo 'export MUMPS_SOLVERS="dmumps"' >> ~/.bashrc
source ~/.bashrcgit clone https://github.com/imadki/mumps4py.git
cd mumps4py
python setup.py build_ext --inplacepip install .python3 -m pip install --user -e .import mumps4py.mumps_solver as mps
solver = mps.MumpsSolver(verbose=True, system="double")
print("MUMPS Solver Initialized:", solver)pytest tests/or
python -m pytesttests/test_cmumps.py s [25%]
tests/test_dmumps.py . [50%]
tests/test_smumps.py s [75%]
tests/test_zmumps.py s [100%]python setup.py clean@techreport{mumps4py2025,
title = {Mumps4py: Python interface for the MUMPS solver},
author = {I. Kissami},
month = mar,
year = {2025},
institution = {Mohammed VI Polytechnic University},
doi = {10.13140/RG.2.2.26885.05606/2}
}
