Skip to content

Add MPI parallelization infrastructure for distributed FE computation#35

Draft
Copilot wants to merge 2 commits into
next_v26.05from
copilot/estimate-mpi-transition-complexity
Draft

Add MPI parallelization infrastructure for distributed FE computation#35
Copilot wants to merge 2 commits into
next_v26.05from
copilot/estimate-mpi-transition-complexity

Conversation

Copilot AI commented May 27, 2026

Copy link
Copy Markdown
Contributor

Adds foundational MPI infrastructure using mpi4py/petsc4py for distributed-memory parallelization. Uses a replicated-model approach: all ranks hold the full mesh, elements are partitioned for parallel computation, results combined via Allreduce. This parallelizes the expensive element evaluation phase with minimal architectural disruption.

New package: edelweissfe/numerics/mpi/

  • mpiutils.py — Thin mpi4py wrapper with serial fallback stubs (comm, rank, size, collectives)
  • partitioner.py — Element partitioning via Recursive Coordinate Bisection; node ownership = lowest-ranked element owner; ghost identification
  • distributeddofmanager.py — Local/ghost/global DOF index maps, PETSc ownership ranges
  • petscsolver.py — Distributed PETSc Mat/Vec/KSP with batch assembly

New solver: NISTMPI

  • Extends NIST with partitioned computeElements() — each rank evaluates its element subset
  • Allreduce(SUM) on P, K, F vectors so all ranks have consistent global state
  • Convergence checks are rank-identical (no additional collective needed)
*solver, solver=NISTMPI, name=theSolver
mpirun -np 4 edelweissfe input.inp

Config

  • edelweissfe/config/solvers.py: register "NISTMPI""nonlinearimplicitstaticmpi"

Limitations / future work

This is the "medium" difficulty path from the analysis — replicated model with partitioned computation. True distributed scalability (ghost exchange, distributed Mat assembly, rank-aware I/O) requires the deeper refactor of DofManager/VIJSystemMatrix ownership semantics.

Copilot AI added 2 commits May 27, 2026 17:40
- Add edelweissfe/numerics/mpi/ package with:
  - mpiutils.py: MPI communicator wrapper with fallback stubs
  - partitioner.py: Mesh partitioning with RCB algorithm
  - distributeddofmanager.py: Local/ghost/global DOF mapping
  - petscsolver.py: Distributed PETSc KSP linear solver
- Add NISTMPI solver (nonlinearimplicitstaticmpi.py) extending NIST
  with MPI-parallel element computation and collective reductions
- Register NISTMPI in solver library
- Add MPI test input file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants