Author: S. Loisel
Distributed sparse matrix and vector operations using MPI for Julia. This package provides efficient parallel linear algebra operations across multiple MPI ranks.
- Distributed sparse matrices (
SparseMatrixMPI{T}) with row-partitioning across MPI ranks - Distributed dense vectors (
VectorMPI{T}) with flexible partitioning - Matrix-matrix multiplication (
A * B) with memoized communication plans - Matrix-vector multiplication (
A * x,mul!(y, A, x)) - Sparse direct solvers: LU and LDLT factorization using MUMPS
- Lazy transpose with optimized multiplication rules
- Matrix addition/subtraction (
A + B,A - B) - Vector operations: norms, reductions, arithmetic with automatic partition alignment
- Support for both
Float64andComplexF64element types
using Pkg
Pkg.add("LinearAlgebraMPI")using MPI
MPI.Init()
using LinearAlgebraMPI
using SparseArrays
# Create a sparse matrix (must be identical on all ranks)
A_global = sprand(1000, 1000, 0.01)
A = SparseMatrixMPI{Float64}(A_global)
# Create a vector
x_global = rand(1000)
x = VectorMPI(x_global)
# Matrix-vector multiplication
y = A * x
# Matrix-matrix multiplication
B_global = sprand(1000, 500, 0.01)
B = SparseMatrixMPI{Float64}(B_global)
C = A * B
# Transpose operations
At = transpose(A)
D = At * B # Materializes transpose as needed
# Solve linear systems
using LinearAlgebra
A_sym = A + transpose(A) + 10I # Make symmetric positive definite
A_sym_dist = SparseMatrixMPI{Float64}(A_sym)
F = ldlt(A_sym_dist) # LDLT factorization
x_sol = solve(F, y) # Solve A_sym * x_sol = ympiexec -n 4 julia your_script.jlFor detailed documentation, see the stable docs or dev docs.