Skip to content

Cleanup custom MPI flow#762

Merged
TysonRayJones merged 28 commits into
develfrom
cleanup-custom-mpi
Jun 1, 2026
Merged

Cleanup custom MPI flow#762
TysonRayJones merged 28 commits into
develfrom
cleanup-custom-mpi

Conversation

@TysonRayJones
Copy link
Copy Markdown
Member

No description provided.

These exemptions for communicator NULL-ness enable an error message to reach the user even then the user has called MPI_Init themselves but then triggered a validation error before the communicator could be set
for consistency with e.g. env.isMultithreaded. The user arg to e.g. initQuESTEnv() is kept as "userOwnsMpi" for a very superficial consistency with e.g. "useMultithreaded" :^)
by just using extern. This is terrible and inadvisable, but offers an easier understanding of the software architecture (and so is easier to fix correctly) than the previous "macros change which signatures this header exposes" design.

Also, we removed the unnecessary avoiding of defining comm_setMpiComm when SUBCOMM was not defined, which made the architecture even more confusing. Now, SUBCOMM only influences the contents of subcommunicator.cpp and subcommunicator.hpp. Simple!
although I suspect this is a poor choice of name. The logic should always be considered "compiled" when MPI is known, and we choose instead whether to "expose" the MPI signature to the users
without triggering an internal error
replacing the original internal error. Note that all of the other MPI functions between comm_config.cpp and comm_subroutines.cpp are unguarded; we should create a macro around them
Comment thread quest/src/core/validation.cpp Outdated
@TysonRayJones
Copy link
Copy Markdown
Member Author

This must not be merged until #765 is merged into this

- added comm_isActive to indicate whether QuEST is using MPI (which is distinct from whether MPI itself is initialised)
- renamed comm_isInit to comm_isMpiInit, since it queries MPI directly/globally, and when true, does not indicate whether QuEST is actually using MPI
- record isMpiUserOwned within comm_config.cpp, since failed-validation must not kill user-owned MPI, and it must know user-ownership before QuESTEnv succeeds/records it (because validation can fail DURING QuESTEnv initialisation)
- explicitly divided (through doc) comm_config.cpp into things which query MPI globally, and thinks which query only QuEST's MPI env/communicator
though this receive a final polish in the final PR to dev (or in a commit thereafter if change anything drastic)
@TysonRayJones TysonRayJones merged commit b058ac8 into devel Jun 1, 2026
19 of 130 checks passed
@TysonRayJones TysonRayJones deleted the cleanup-custom-mpi branch June 1, 2026 23:04
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