Skip to main content

MUMPS Overview

Introduction to MUMPS Fortran Framework

MUMPS (Massive Unstructured Parallel Sparse) is a highly scalable parallel sparse direct solver designed for solving large, sparse linear systems. It is written in Fortran and provides a framework for solving a wide range of application problems efficiently. In this tutorial, we will explore the history, features, and examples of the MUMPS Fortran Framework.

History of MUMPS

MUMPS was initially developed in the early 1990s by researchers at CERFACS (Centre Européen de Recherche et de Formation Avancée en Calcul Scientifique) in France. It was primarily designed to solve sparse linear systems arising from the finite element method. Over the years, the framework has been extensively revised and improved to handle larger problem sizes and exploit parallel architectures efficiently.

Features of MUMPS

  1. Parallel Scalability: MUMPS is designed to efficiently utilize parallel architectures, such as distributed memory systems and shared memory systems. It can exploit both message passing interface (MPI) and thread-based parallelism to achieve high-performance computing.

  2. Sparse Direct Solver: MUMPS employs a direct solver approach to solve sparse linear systems. It is particularly efficient for problems with irregular and unstructured matrices, where iterative methods may converge slowly or fail altogether.

  3. Support for Symmetric Positive Definite Systems: MUMPS can solve symmetric positive definite systems more efficiently by using specialized algorithms. This feature is particularly useful in many scientific and engineering applications.

  4. Interface with Other Programming Languages: MUMPS provides interfaces with other programming languages, including C, Python, and MATLAB. This allows users to leverage the power of MUMPS within their preferred programming environment.

  5. Memory Management: MUMPS includes sophisticated memory management techniques to handle large-scale problems efficiently. It optimizes memory usage by dynamically allocating and deallocating memory as required.

Examples of MUMPS Fortran Framework

Example 1: Solving a Sparse Linear System

program sparse_linear_system
use mumps_lib
implicit none

integer :: n, nnz, ierr
integer, allocatable :: irn(:), jcn(:)
real(kind=8), allocatable :: a(:), b(:)

! Initialize the problem size and sparse matrix
n = 5
nnz = 10
allocate(irn(nnz), jcn(nnz), a(nnz), b(n))

irn = [1, 1, 2, 2, 2, 3, 3, 4, 4, 5] ! row indices
jcn = [1, 3, 2, 3, 4, 3, 5, 1, 4, 5] ! column indices
a = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0] ! matrix values
b = [1.0, 2.0, 3.0, 4.0, 5.0] ! right-hand side vector

! Initialize and configure MUMPS solver
call dmumps_init(ierr)
call dmumps_set_icntl(1, 6) ! set the parallel factorization method

! Set the problem size and matrix structure
call dmumps_set_centralized(n, nnz, irn, jcn, a, b, ierr)

! Perform the factorization and solve the system
call dmumps_factorize_solve(ierr)

! Get the solution vector
call dmumps_get_solution(b)

! Clean up MUMPS solver
call dmumps_finalize(ierr)

! Display the solution vector
write(*,*) "Solution:", b

deallocate(irn, jcn, a, b)
end program sparse_linear_system

In this example, we solve a sparse linear system using MUMPS. The program initializes the problem size, sparse matrix, and right-hand side vector. It then initializes and configures the MUMPS solver, sets the problem size and matrix structure, performs the factorization, solves the system, and retrieves the solution vector. Finally, it cleans up the MUMPS solver and displays the solution vector.

Example 2: Interface with Python

import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as spla
import mumps

# Create a sparse linear system
n = 5
row = np.array([0, 0, 1, 1, 1, 2, 2, 3, 3, 4])
col = np.array([0, 2, 1, 2, 3, 2, 4, 0, 3, 4])
data = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0])
A = sp.coo_matrix((data, (row, col)), shape=(n, n))
b = np.array([1.0, 2.0, 3.0, 4.0, 5.0])

# Solve the linear system using MUMPS
x = np.zeros(n)
mumps.gssv(A, b, x)

# Display the solution vector
print("Solution:", x)

This example demonstrates the interface between MUMPS and Python using the mumps package. It creates a sparse linear system using the scipy.sparse module, solves the system using MUMPS through the gssv function, and displays the solution vector.

Official Website

To learn more about the MUMPS Fortran Framework, you can visit the official website at http://mumps.enseeiht.fr/. The website provides comprehensive documentation, user guides, and examples to help you get started with MUMPS.

In conclusion, the MUMPS Fortran Framework is a powerful tool for solving large, sparse linear systems efficiently. Its parallel scalability, support for symmetric positive definite systems, and interfaces with other programming languages make it a versatile choice for various scientific and engineering applications.