Skip to content

Support building on a PETSc configured without MPI (MPIUNI)#243

Merged
stevendargaville merged 1 commit into
mainfrom
no-mpi-support
Jul 7, 2026
Merged

Support building on a PETSc configured without MPI (MPIUNI)#243
stevendargaville merged 1 commit into
mainfrom
no-mpi-support

Conversation

@stevendargaville

Copy link
Copy Markdown
Collaborator

Summary

PFLARE previously required PETSc to be configured with MPI (and therefore a graph partitioner like ParMETIS). Every method in PFLARE works in serial, so this lets PFLARE build and pass its tests on top of a PETSc configured without MPI, where PETSc uses its bundled MPIUNI serial-MPI shim (and drops Metis/ParMETIS).

Changes

Source (portable — no behaviour change on real-MPI builds):

  • src/Timers.F90 — use PetscTime() instead of MPI_Wtime() (MPIUNI has no typed Fortran MPI_Wtime).
  • src/TSQR.F90, src/Approx_Inverse_Setup.F90 — guard MPI_Op_create, MPI_IAllreduce, MPI_IBcast with #if !defined(PETSC_HAVE_MPIUNI) (MPIUNI provides no Fortran wrappers for these; they were already parallel-only dead code in serial).
  • MPI_DOUBLEMPI_DOUBLE_PRECISION in MatDiagDom.F90, Repartition.F90, Approx_Inverse_Setup.F90 (MPIUNI's mpif.h doesn't define MPI_DOUBLE).
  • src/C_PETSc_Routines.c#if defined(PETSC_HAVE_PARMETIS) around the partitioner type with a MATPARTITIONINGAVERAGE fallback.

Build/test system:

  • Makefile — detect and export PETSC_HAVE_MPIUNI (mirrors the existing PETSC_HAVE_KOKKOS pattern).
  • tests/Makefile — skip the parallel test targets when PETSC_HAVE_MPIUNI=1 (petsc-mpiexec.uni -n 2 errors out).
  • python/Makefile — split run_tests/run_check into serial/parallel sub-targets; the parallel ones skip under MPIUNI.

CI:

  • dockerfiles/Dockerfile_no_mpi + gnu_opt_no_mpi job using the new stevendargaville/petsc_no_mpi image.

Docs:

  • docs/installation.md — MPI/ParMETIS documented as optional (needed only for parallel).

Testing

Against a Kokkos-enabled, no-MPI PETSc: make build_tests (clean -Werror -Wall + 132-col), make check, make tests_short, make python, make tests_python all pass — serial Fortran/C/Kokkos/Python tests run, parallel ones report "skipped". The CI job exercises the full check/tests on the no-MPI image.

🤖 Generated with Claude Code

Guard the few Fortran MPI symbols MPIUNI does not provide, use PetscTime
instead of MPI_Wtime, fall back off ParMETIS when unavailable, and skip
the parallel test targets when PETSc is built without MPI. Adds a no-MPI
Dockerfile and CI job.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@stevendargaville stevendargaville merged commit 86eb2f7 into main Jul 7, 2026
18 checks passed
@stevendargaville stevendargaville deleted the no-mpi-support branch July 7, 2026 21:59
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.

1 participant