Owns the single call to MPI_Init / MPI_Finalize for any executable that
includes this module, and exposes the world communicator together with the
local rank and total rank count. It runs at any mpirun -np N (and at
-np 1, where the rank/size queries degenerate cleanly).
This module uses only the lowest-common-denominator MPI features (Init,
Finalize, Comm_rank, Comm_size, Allreduce, COMM_WORLD). The Fortran 2008
mpi_f08 module gives us type-safe handles on every implementation that
provides it; MS-MPI on Windows does not ship mpi_f08 yet, so we fall
back to the legacy mpi module when CFD_SOLVER_LEGACY_MPI is defined
at preprocess time (set via -DCFD_SOLVER_LEGACY_MPI on the Windows CI
job). The call-site code is identical either way because mpi_world()
and the named constants resolve to the handle type of whichever module
is in scope.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private, | save | :: | g_my_rank | = | -1 |
Cached identity values, populated by mpi_runtime_init. |
| integer, | private, | save | :: | g_n_ranks | = | -1 | |
| logical, | private, | save | :: | g_initialised | = | .false. |
True after mpi_runtime_init and before mpi_runtime_finalize.
Local rank in MPI_COMM_WORLD. Aborts if called before init.
Size of MPI_COMM_WORLD. Aborts if called before init.
Return the world communicator handle. Convenience accessor so call sites never reference MPI_COMM_WORLD directly. Always call this function at the point of use rather than caching the return value, so the call site stays correct once sub-communicators are introduced.
Expose MPI_PROC_NULL as a value so callers that don't use mpi*
themselves can compare against it.
Finalise the MPI library. Idempotent: a second call is a no-op.
Abort the entire MPI world with a diagnostic message.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | message |