m_mpi Module

Single point of contact between x3d2 and MPI.

When the build enables MPI (-DMPI, set by the WITH_MPI option, on by default) this module is a thin re-export of the mpi module, so use m_mpi is exactly use mpi.

When MPI is disabled the module supplies serial stand-ins for the MPI entities x3d2 uses. A build without MPI is a single rank, so every collective reduces to the identity, ranks are 0 and communicator sizes are 1. Call sites therefore stay free of preprocessor branches: they call MPI_Allreduce, MPI_Comm_rank and friends unconditionally and get the right serial answer. Point-to-point communication is the exception: it is only reachable on more than one rank, so those stubs stop the run instead.

Add a stub here rather than an #ifdef MPI at a call site when new MPI calls appear. The only guards left in the tree are around communication on device buffers, which cannot be typed generically here.


Uses

  • module~~m_mpi~~UsesGraph module~m_mpi m_mpi iso_fortran_env iso_fortran_env module~m_mpi->iso_fortran_env mpi mpi module~m_mpi->mpi

Used by

  • module~~m_mpi~~UsedByGraph module~m_mpi m_mpi module~m_base_case m_base_case module~m_base_case->module~m_mpi module~m_common m_common module~m_base_case->module~m_common module~m_io_manager m_io_manager module~m_base_case->module~m_io_manager module~m_mesh m_mesh module~m_base_case->module~m_mesh module~m_allocator m_allocator module~m_base_case->module~m_allocator module~m_base_backend m_base_backend module~m_base_case->module~m_base_backend module~m_config m_config module~m_base_case->module~m_config module~m_field m_field module~m_base_case->module~m_field module~m_monitoring m_monitoring module~m_base_case->module~m_monitoring module~m_postprocess m_postprocess module~m_base_case->module~m_postprocess module~m_solver m_solver module~m_base_case->module~m_solver module~m_case_channel m_case_channel module~m_case_channel->module~m_mpi module~m_case_channel->module~m_base_case module~m_case_channel->module~m_common module~m_case_channel->module~m_mesh module~m_case_channel->module~m_allocator module~m_case_channel->module~m_base_backend module~m_case_channel->module~m_config module~m_case_channel->module~m_field module~m_case_channel->module~m_solver module~m_case_cylinder m_case_cylinder module~m_case_cylinder->module~m_mpi module~m_case_cylinder->module~m_base_case module~m_case_cylinder->module~m_common module~m_case_cylinder->module~m_mesh module~m_case_cylinder->module~m_allocator module~m_case_cylinder->module~m_base_backend module~m_case_cylinder->module~m_config module~m_case_cylinder->module~m_field module~m_case_cylinder->module~m_solver module~m_checkpoint_manager m_checkpoint_manager module~m_checkpoint_manager->module~m_mpi module~m_checkpoint_manager->module~m_common module~m_stats m_stats module~m_checkpoint_manager->module~m_stats module~m_checkpoint_manager->module~m_config module~m_checkpoint_manager->module~m_field module~m_io_field_utils m_io_field_utils module~m_checkpoint_manager->module~m_io_field_utils module~m_io_session m_io_session module~m_checkpoint_manager->module~m_io_session module~m_checkpoint_manager->module~m_solver module~m_checkpoint_state m_checkpoint_state module~m_checkpoint_manager->module~m_checkpoint_state module~m_common->module~m_mpi module~m_cuda_backend m_cuda_backend module~m_cuda_backend->module~m_mpi module~m_cuda_backend->module~m_common module~m_cuda_poisson_fft m_cuda_poisson_fft module~m_cuda_backend->module~m_cuda_poisson_fft module~m_cuda_sendrecv m_cuda_sendrecv module~m_cuda_backend->module~m_cuda_sendrecv module~m_cuda_backend->module~m_mesh module~m_cuda_backend->module~m_allocator module~m_cuda_backend->module~m_base_backend module~m_cuda_allocator m_cuda_allocator module~m_cuda_backend->module~m_cuda_allocator module~m_cuda_exec_dist m_cuda_exec_dist module~m_cuda_backend->module~m_cuda_exec_dist module~m_cuda_exec_thom m_cuda_exec_thom module~m_cuda_backend->module~m_cuda_exec_thom module~m_cuda_kernels_dist m_cuda_kernels_dist module~m_cuda_backend->module~m_cuda_kernels_dist module~m_cuda_kernels_fieldops m_cuda_kernels_fieldops module~m_cuda_backend->module~m_cuda_kernels_fieldops module~m_cuda_kernels_reorder m_cuda_kernels_reorder module~m_cuda_backend->module~m_cuda_kernels_reorder module~m_cuda_tdsops m_cuda_tdsops module~m_cuda_backend->module~m_cuda_tdsops module~m_cuda_backend->module~m_field module~m_tdsops m_tdsops module~m_cuda_backend->module~m_tdsops module~m_cuda_poisson_fft->module~m_mpi module~m_cuda_poisson_fft->module~m_common module~m_cuda_poisson_fft->module~m_cuda_sendrecv module~m_cuda_poisson_fft->module~m_mesh module~m_cuda_poisson_fft->module~m_cuda_allocator module~m_cuda_spectral m_cuda_spectral module~m_cuda_poisson_fft->module~m_cuda_spectral module~m_cuda_poisson_fft->module~m_field module~m_poisson_fft m_poisson_fft module~m_cuda_poisson_fft->module~m_poisson_fft module~m_cuda_poisson_fft->module~m_tdsops module~m_cuda_sendrecv->module~m_mpi module~m_cuda_sendrecv->module~m_common module~m_decomp~2 m_decomp module~m_decomp~2->module~m_mpi module~m_ibm m_ibm module~m_ibm->module~m_mpi module~m_ibm->module~m_common module~m_ibm->module~m_mesh module~m_ibm->module~m_allocator module~m_ibm->module~m_base_backend module~m_ibm->module~m_field module~m_ibm->module~m_io_session module~m_io_backend~2 m_io_backend module~m_io_backend~2->module~m_mpi module~m_io_backend~2->module~m_common module~m_io_backend~2->module~m_base_backend module~m_io_backend~2->module~m_field module~m_io_base m_io_base module~m_io_backend~2->module~m_io_base module~m_io_manager->module~m_mpi module~m_io_manager->module~m_checkpoint_manager module~m_snapshot_manager m_snapshot_manager module~m_io_manager->module~m_snapshot_manager module~m_io_manager->module~m_stats module~m_io_manager->module~m_solver module~m_io_manager->module~m_checkpoint_state module~m_mesh->module~m_mpi module~m_mesh->module~m_common module~m_mesh->module~m_field module~m_mesh_content m_mesh_content module~m_mesh->module~m_mesh_content module~m_omp_backend m_omp_backend module~m_omp_backend->module~m_mpi module~m_omp_backend->module~m_common module~m_omp_backend->module~m_mesh module~m_omp_sendrecv m_omp_sendrecv module~m_omp_backend->module~m_omp_sendrecv module~m_omp_backend->module~m_allocator module~m_omp_backend->module~m_base_backend module~m_exec_thom m_exec_thom module~m_omp_backend->module~m_exec_thom module~m_omp_backend->module~m_field module~m_omp_exec_dist m_omp_exec_dist module~m_omp_backend->module~m_omp_exec_dist module~m_ordering m_ordering module~m_omp_backend->module~m_ordering module~m_omp_backend->module~m_tdsops module~m_omp_sendrecv->module~m_mpi module~m_omp_sendrecv->module~m_common module~m_omptgt_backend m_omptgt_backend module~m_omptgt_backend->module~m_mpi module~m_omptgt_backend->module~m_common module~m_omptgt_backend->module~m_mesh module~m_omptgt_backend->module~m_omp_backend module~m_omptgt_backend->module~m_allocator module~m_omptgt_backend->module~m_field module~m_omptgt_allocator m_omptgt_allocator module~m_omptgt_backend->module~m_omptgt_allocator module~m_omptgt_backend->module~m_ordering module~m_snapshot_manager->module~m_mpi module~m_snapshot_manager->module~m_common module~m_snapshot_manager->module~m_config module~m_snapshot_manager->module~m_field module~m_snapshot_manager->module~m_io_field_utils module~m_snapshot_manager->module~m_io_session module~m_snapshot_manager->module~m_solver module~m_stats->module~m_mpi module~m_stats->module~m_common module~m_stats->module~m_config module~m_stats->module~m_field module~m_stats->module~m_io_session module~m_stats->module~m_solver program~xcompact xcompact program~xcompact->module~m_mpi program~xcompact->module~m_base_case program~xcompact->module~m_case_channel program~xcompact->module~m_case_cylinder program~xcompact->module~m_common program~xcompact->module~m_cuda_backend program~xcompact->module~m_mesh program~xcompact->module~m_omp_backend program~xcompact->module~m_allocator program~xcompact->module~m_base_backend module~m_case_generic m_case_generic program~xcompact->module~m_case_generic module~m_case_tgv m_case_tgv program~xcompact->module~m_case_tgv program~xcompact->module~m_config program~xcompact->module~m_cuda_allocator module~m_allocator->module~m_common module~m_allocator->module~m_field module~m_base_backend->module~m_common module~m_base_backend->module~m_mesh module~m_base_backend->module~m_allocator module~m_base_backend->module~m_field module~m_base_backend->module~m_poisson_fft module~m_base_backend->module~m_tdsops module~m_case_generic->module~m_base_case module~m_case_generic->module~m_common module~m_case_generic->module~m_mesh module~m_case_generic->module~m_allocator module~m_case_generic->module~m_base_backend module~m_case_generic->module~m_field module~m_case_generic->module~m_solver module~m_case_tgv->module~m_base_case module~m_case_tgv->module~m_common module~m_case_tgv->module~m_mesh module~m_case_tgv->module~m_allocator module~m_case_tgv->module~m_base_backend module~m_case_tgv->module~m_field module~m_case_tgv->module~m_solver module~m_config->module~m_common module~m_cuda_allocator->module~m_common module~m_cuda_allocator->module~m_mesh module~m_cuda_allocator->module~m_allocator module~m_cuda_allocator->module~m_field module~m_cuda_exec_dist->module~m_common module~m_cuda_exec_dist->module~m_cuda_sendrecv module~m_cuda_exec_dist->module~m_cuda_kernels_dist module~m_cuda_exec_dist->module~m_cuda_tdsops module~m_cuda_exec_thom->module~m_common module~m_cuda_kernels_thom m_cuda_kernels_thom module~m_cuda_exec_thom->module~m_cuda_kernels_thom module~m_cuda_exec_thom->module~m_cuda_tdsops module~m_cuda_kernels_dist->module~m_common module~m_cuda_kernels_fieldops->module~m_common module~m_cuda_kernels_reorder->module~m_common module~m_cuda_kernels_thom->module~m_common module~m_cuda_spectral->module~m_common module~m_cuda_tdsops->module~m_common module~m_cuda_tdsops->module~m_tdsops module~m_exec_thom->module~m_common module~m_omp_kernels_thom m_omp_kernels_thom module~m_exec_thom->module~m_omp_kernels_thom module~m_exec_thom->module~m_tdsops module~m_field->module~m_common module~m_io_backend m_io_backend module~m_io_backend->module~m_common module~m_io_backend->module~m_base_backend module~m_io_backend->module~m_field module~m_io_backend->module~m_io_base module~m_io_base->module~m_common module~m_io_base->module~m_base_backend module~m_io_base->module~m_field module~m_io_field_utils->module~m_common module~m_io_field_utils->module~m_field module~m_io_field_utils->module~m_io_base module~m_io_field_utils->module~m_solver module~m_io_session->module~m_common module~m_io_session->module~m_io_backend~2 module~m_io_session->module~m_base_backend module~m_io_session->module~m_field module~m_io_session->module~m_io_base module~m_les m_les module~m_les->module~m_common module~m_les->module~m_mesh module~m_les->module~m_base_backend module~m_les->module~m_config module~m_les->module~m_field module~m_les->module~m_tdsops module~m_mesh_content->module~m_common module~m_monitoring->module~m_common module~m_monitoring->module~m_field module~m_scalar_series m_scalar_series module~m_monitoring->module~m_scalar_series module~m_monitoring->module~m_solver module~m_omp_exec_dist->module~m_common module~m_omp_exec_dist->module~m_omp_sendrecv module~m_omp_kernels_dist m_omp_kernels_dist module~m_omp_exec_dist->module~m_omp_kernels_dist module~m_omp_exec_dist->module~m_tdsops module~m_omp_kernels_dist->module~m_common module~m_omp_kernels_thom->module~m_common module~m_omp_poisson_fft m_omp_poisson_fft module~m_omp_poisson_fft->module~m_common module~m_omp_poisson_fft->module~m_mesh module~m_omp_poisson_fft->module~m_field module~m_omp_spectral m_omp_spectral module~m_omp_poisson_fft->module~m_omp_spectral module~m_omp_poisson_fft->module~m_poisson_fft module~m_omp_poisson_fft->module~m_tdsops module~m_omp_spectral->module~m_common module~m_omptgt_allocator->module~m_common module~m_omptgt_allocator->module~m_mesh module~m_omptgt_allocator->module~m_allocator module~m_omptgt_allocator->module~m_field module~m_ordering->module~m_common module~m_poisson_fft->module~m_common module~m_poisson_fft->module~m_mesh module~m_poisson_fft->module~m_field module~m_poisson_fft->module~m_tdsops module~m_postprocess->module~m_common module~m_postprocess->module~m_field module~m_postprocess->module~m_solver module~m_scalar_series->module~m_common module~m_solver->module~m_common module~m_solver->module~m_ibm module~m_solver->module~m_mesh module~m_solver->module~m_allocator module~m_solver->module~m_base_backend module~m_solver->module~m_config module~m_solver->module~m_field module~m_solver->module~m_les module~m_solver->module~m_tdsops module~m_time_integrator m_time_integrator module~m_solver->module~m_time_integrator module~m_vector_calculus m_vector_calculus module~m_solver->module~m_vector_calculus module~m_tdsops->module~m_common module~m_time_integrator->module~m_common module~m_time_integrator->module~m_allocator module~m_time_integrator->module~m_base_backend module~m_time_integrator->module~m_field module~m_vector_calculus->module~m_common module~m_vector_calculus->module~m_allocator module~m_vector_calculus->module~m_base_backend module~m_vector_calculus->module~m_field module~m_vector_calculus->module~m_tdsops module~m_checkpoint_state->module~m_io_session proc~decomposition_2decomp m_decomp::decomposition_2decomp proc~decomposition_2decomp->module~m_mesh_content proc~decomposition_2decomp~2 m_decomp::decomposition_2decomp proc~decomposition_2decomp~2->module~m_mesh_content proc~decomposition_generic m_mesh::decomposition_generic proc~decomposition_generic->module~m_mesh_content proc~init_omp_poisson_fft m_omp_backend::omp_backend_t%init_omp_poisson_fft proc~init_omp_poisson_fft->module~m_omp_poisson_fft

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: MPI_COMM_NULL = 0

Handles are opaque in MPI, so the values only have to be distinct.

integer, public, parameter :: MPI_COMM_WORLD = 1
integer, public, parameter :: MPI_COMM_SELF = 2
integer, public, parameter :: MPI_SUCCESS = 0
integer, public, parameter :: MPI_SUM = 1
integer, public, parameter :: MPI_MAX = 2
integer, public, parameter :: MPI_MIN = 3
integer, public, parameter :: MPI_LAND = 4
integer, public, parameter :: MPI_INTEGER = 1
integer, public, parameter :: MPI_LOGICAL = 2
integer, public, parameter :: MPI_REAL = 3
integer, public, parameter :: MPI_DOUBLE_PRECISION = 4
integer, public, parameter :: MPI_COMPLEX = 5
integer, public, parameter :: MPI_DOUBLE_COMPLEX = 6
integer, public, parameter :: MPI_STATUS_SIZE = 6
integer, public, parameter :: MPI_STATUS_IGNORE(MPI_STATUS_SIZE) = 0
integer, public, parameter :: MPI_STATUSES_IGNORE(MPI_STATUS_SIZE,1) = 0
type(mpi_in_place_t), public, parameter :: MPI_IN_PLACE = mpi_in_place_t(0)

Interfaces

public interface MPI_Allreduce

  • private subroutine allreduce_in_place(sendbuf, recvbuf, count, datatype, op, comm, ierror)

    Reducing one rank's contribution in place leaves the buffer as it is, whatever its type, shape or the operation asked for.

    Arguments

    Type IntentOptional Attributes Name
    type(mpi_in_place_t), intent(in) :: sendbuf
    type(*), intent(inout), dimension(..) :: recvbuf
    integer, intent(in) :: count
    integer, intent(in) :: datatype
    integer, intent(in) :: op
    integer, intent(in) :: comm
    integer, intent(out) :: ierror
  • private subroutine allreduce_r32(sendbuf, recvbuf, count, datatype, op, comm, ierror)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: sendbuf
    real(kind=real32), intent(out) :: recvbuf
    integer, intent(in) :: count
    integer, intent(in) :: datatype
    integer, intent(in) :: op
    integer, intent(in) :: comm
    integer, intent(out) :: ierror
  • private subroutine allreduce_r64(sendbuf, recvbuf, count, datatype, op, comm, ierror)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: sendbuf
    real(kind=real64), intent(out) :: recvbuf
    integer, intent(in) :: count
    integer, intent(in) :: datatype
    integer, intent(in) :: op
    integer, intent(in) :: comm
    integer, intent(out) :: ierror
  • private subroutine allreduce_r64_1d(sendbuf, recvbuf, count, datatype, op, comm, ierror)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: sendbuf(:)
    real(kind=real64), intent(out) :: recvbuf(:)
    integer, intent(in) :: count
    integer, intent(in) :: datatype
    integer, intent(in) :: op
    integer, intent(in) :: comm
    integer, intent(out) :: ierror

public interface MPI_Reduce

  • private subroutine reduce_r32(sendbuf, recvbuf, count, datatype, op, root, comm, ierror)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: sendbuf
    real(kind=real32), intent(out) :: recvbuf
    integer, intent(in) :: count
    integer, intent(in) :: datatype
    integer, intent(in) :: op
    integer, intent(in) :: root
    integer, intent(in) :: comm
    integer, intent(out) :: ierror
  • private subroutine reduce_r64(sendbuf, recvbuf, count, datatype, op, root, comm, ierror)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: sendbuf
    real(kind=real64), intent(out) :: recvbuf
    integer, intent(in) :: count
    integer, intent(in) :: datatype
    integer, intent(in) :: op
    integer, intent(in) :: root
    integer, intent(in) :: comm
    integer, intent(out) :: ierror

Derived Types

type, public ::  mpi_in_place_t

MPI_IN_PLACE is a sentinel, not data. Giving it a type of its own is what lets the generic MPI_Allreduce below tell an in-place call (a no-op here) from one with separate send and receive buffers (a copy here).


Functions

public function MPI_Wtime() result(t)

Elapsed wall-clock seconds, from an arbitrary origin as MPI defines it.

Arguments

None

Return Value real(kind=real64)


Subroutines

public subroutine MPI_Init(ierror)

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: ierror

public subroutine MPI_Finalize(ierror)

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: ierror

public subroutine MPI_Initialized(flag, ierror)

Reported as initialised whether or not MPI_Init has been called. There is no MPI environment to bring up here, so callers asking whether it is safe to proceed always have their answer, and a library handed a communicator never has to wait for one.

Arguments

Type IntentOptional Attributes Name
logical, intent(out) :: flag
integer, intent(out) :: ierror

public subroutine MPI_Abort(comm, errorcode, ierror)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: comm
integer, intent(in) :: errorcode
integer, intent(out) :: ierror

public subroutine MPI_Comm_rank(comm, rank, ierror)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: comm
integer, intent(out) :: rank
integer, intent(out) :: ierror

public subroutine MPI_Comm_size(comm, size, ierror)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: comm
integer, intent(out) :: size
integer, intent(out) :: ierror

public subroutine MPI_Barrier(comm, ierror)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: comm
integer, intent(out) :: ierror

public subroutine MPI_Bcast(buffer, count, datatype, root, comm, ierror)

The only rank is the root, so its buffer is already the broadcast value.

Arguments

Type IntentOptional Attributes Name
type(*), intent(inout), dimension(..) :: buffer
integer, intent(in) :: count
integer, intent(in) :: datatype
integer, intent(in) :: root
integer, intent(in) :: comm
integer, intent(out) :: ierror

public subroutine MPI_Isend(buf, count, datatype, dest, tag, comm, request, ierror)

Arguments

Type IntentOptional Attributes Name
type(*), intent(in), dimension(..) :: buf
integer, intent(in) :: count
integer, intent(in) :: datatype
integer, intent(in) :: dest
integer, intent(in) :: tag
integer, intent(in) :: comm
integer, intent(out) :: request
integer, intent(out) :: ierror

public subroutine MPI_Irecv(buf, count, datatype, source, tag, comm, request, ierror)

Arguments

Type IntentOptional Attributes Name
type(*), intent(inout), dimension(..) :: buf
integer, intent(in) :: count
integer, intent(in) :: datatype
integer, intent(in) :: source
integer, intent(in) :: tag
integer, intent(in) :: comm
integer, intent(out) :: request
integer, intent(out) :: ierror

public subroutine MPI_Waitall(count, array_of_requests, array_of_statuses, ierror)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: count
integer, intent(inout) :: array_of_requests(*)
integer, intent(in) :: array_of_statuses(*)
integer, intent(out) :: ierror

public subroutine MPI_Sendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status, ierror)

Reachable only where a call site has already branched on a rank count above one, as the exchanges in the CUDA Poisson solver do. It exists so that callers can name it in a use m_mpi, only: list that has to compile in both builds.

Arguments

Type IntentOptional Attributes Name
type(*), intent(in), dimension(..) :: sendbuf
integer, intent(in) :: sendcount
integer, intent(in) :: sendtype
integer, intent(in) :: dest
integer, intent(in) :: sendtag
type(*), intent(inout), dimension(..) :: recvbuf
integer, intent(in) :: recvcount
integer, intent(in) :: recvtype
integer, intent(in) :: source
integer, intent(in) :: recvtag
integer, intent(in) :: comm
integer, intent(in) :: status(*)
integer, intent(out) :: ierror