Support building on a PETSc configured without MPI (MPIUNI)#243
Merged
Conversation
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]>
612f9ef to
73a0c0c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— usePetscTime()instead ofMPI_Wtime()(MPIUNI has no typed FortranMPI_Wtime).src/TSQR.F90,src/Approx_Inverse_Setup.F90— guardMPI_Op_create,MPI_IAllreduce,MPI_IBcastwith#if !defined(PETSC_HAVE_MPIUNI)(MPIUNI provides no Fortran wrappers for these; they were already parallel-only dead code in serial).MPI_DOUBLE→MPI_DOUBLE_PRECISIONinMatDiagDom.F90,Repartition.F90,Approx_Inverse_Setup.F90(MPIUNI'smpif.hdoesn't defineMPI_DOUBLE).src/C_PETSc_Routines.c—#if defined(PETSC_HAVE_PARMETIS)around the partitioner type with aMATPARTITIONINGAVERAGEfallback.Build/test system:
Makefile— detect and exportPETSC_HAVE_MPIUNI(mirrors the existingPETSC_HAVE_KOKKOSpattern).tests/Makefile— skip the parallel test targets whenPETSC_HAVE_MPIUNI=1(petsc-mpiexec.uni -n 2errors out).python/Makefile— splitrun_tests/run_checkinto serial/parallel sub-targets; the parallel ones skip under MPIUNI.CI:
dockerfiles/Dockerfile_no_mpi+gnu_opt_no_mpijob using the newstevendargaville/petsc_no_mpiimage.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_pythonall pass — serial Fortran/C/Kokkos/Python tests run, parallel ones report "skipped". The CI job exercises the fullcheck/testson the no-MPI image.🤖 Generated with Claude Code