Skip to content

sloisel/MultiGridBarrierPETSc.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MultiGridBarrierPETSc.jl

Stable Dev Build Status Coverage

A Julia package that bridges MultiGridBarrier.jl and SafePETSc.jl for distributed multigrid barrier computations.

MultiGridBarrierPETSc.jl extends MultiGridBarrier's API to work with PETSc's distributed Mat and Vec types, enabling efficient parallel computation of multigrid barrier methods across multiple MPI ranks.

Quick Start

using MultiGridBarrierPETSc
MultiGridBarrierPETSc.Init()  # Initialize MPI, PETSc, and MUMPS solver

# Solve a 2D finite element problem with PETSc distributed types
sol = fem2d_petsc_solve(Float64; L=3, p=1.0, verbose=false)

# Convert to native types for plotting
using MultiGridBarrier
sol_native = petsc_to_native(sol)
plot(sol_native)

Key Features

  • Drop-in Replacement: Seamlessly use PETSc types with MultiGridBarrier's API
  • Distributed Computing: Leverage PETSc's distributed linear algebra for large-scale problems
  • Type Conversion: Easy conversion between native Julia arrays and PETSc distributed types
  • MPI-Aware: All operations correctly handle MPI collective requirements
  • Automatic MUMPS: Direct solver automatically configured for accurate Newton iterations

Installation

using Pkg
Pkg.add("MultiGridBarrierPETSc")

Prerequisites:

  • Julia 1.10 or later
  • MPI installation (OpenMPI, MPICH, or Intel MPI)
  • PETSc with MUMPS (automatically installed via PETSc_jll.jl, or custom build for HPC)

See the Installation Guide for detailed instructions.

Documentation

Running Examples

# Basic solve example
julia -e 'using MPI; run(`$(MPI.mpiexec()) -n 4 $(Base.julia_cmd()) examples/basic_solve.jl`)'

# Round-trip conversion example
julia -e 'using MPI; run(`$(MPI.mpiexec()) -n 4 $(Base.julia_cmd()) examples/roundtrip_conversion.jl`)'

Add --project or other Julia options as needed for your environment.

Testing

Run the test suite with 4 MPI ranks:

julia --project=. -e 'using Pkg; Pkg.test()'

Type Mappings

Native Julia Type PETSc Distributed Type Storage
Matrix{T} Mat{T, MPIDENSE} Dense distributed
Vector{T} Vec{T} Dense distributed
SparseMatrixCSC{T,Int} Mat{T, MPIAIJ} Sparse distributed

Package Ecosystem

Citation

If you use this package in your research, please cite:

@software{multigridbarrierpetsc,
  author = {Loisel, Sebastien},
  title = {MultiGridBarrierPETSc.jl: Distributed Multigrid Barrier Methods},
  year = {2024},
  url = {https://github.com/sloisel/MultiGridBarrierPETSc.jl}
}

Development

To develop this package locally:

git clone https://github.com/sloisel/MultiGridBarrierPETSc.jl
cd MultiGridBarrierPETSc.jl
julia --project -e 'using Pkg; Pkg.instantiate()'
julia --project -e 'using Pkg; Pkg.test()'

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages