Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
gs_mpi_rma::gs_mpi_rma_t Type Referenceabstract

Gather-scatter communication using MPI one-sided puts into a passive target window, with per-rank signalling for completion. More...

Inheritance diagram for gs_mpi_rma::gs_mpi_rma_t:
Collaboration diagram for gs_mpi_rma::gs_mpi_rma_t:

Public Member Functions

procedure, pass(this) init (this, send_pe, recv_pe)
 Initialise MPI RMA based communication method.
 
procedure, pass(this) free (this)
 Deallocate MPI RMA based communication method.
 
procedure, pass(this) nbsend (this, u, n, tag, deps, strm)
 Pack the gathered shared dofs and put them into each neighbour's receive window, then announce the puts. See the type comment for why the puts, the flush and the signals are separate phases.
 
procedure, pass(this) nbrecv (this, tag)
 No-op: receives are completed by the remote put and its signal.
 
procedure, pass(this) nbwait (this, u, n, op, strm)
 Wait per neighbour for the signal that its data has landed, reduce the slab into u, and ack the sender so it may overwrite the slab next round.
 
procedure, pass(this) nbsend_vec (this, u, n, nc, tag, deps, strm)
 Fused nc-component send: pack nc contiguous component blocks per peer slab and put nc*ndofs reals. Buffer indexing and put sizes scale by nc; the signalling is unchanged.
 
procedure, pass(this) nbrecv_vec (this, tag, nc)
 No-op: receives are completed by the remote put and its signal.
 
procedure, pass(this) nbwait_vec (this, u, n, nc, op, strm)
 Fused nc-component wait/reduce: per peer, wait on the data signal and reduce nc component blocks into u, then ack the sender.
 
procedure(gs_comm_init), deferred, pass init gs_comm_init
 
procedure(gs_comm_free), deferred, pass free gs_comm_free
 
procedure(gs_nbsend), deferred, pass nbsend gs_nbsend
 
procedure(gs_nbrecv), deferred, pass nbrecv gs_nbrecv
 
procedure(gs_nbwait), deferred, pass nbwait gs_nbwait
 
procedure, pass(this) init_dofs (this)
 
procedure, pass(this) free_dofs (this)
 
procedure, pass(this) init_order (this, send_pe, recv_pe)
 Obtains which ranks to send and receive data from.
 
procedure, pass(this) free_order (this)
 
procedure, pass(this) take_schedule (this, src)
 Take over the gather-scatter schedule (dof lists and peer order) of src, avoiding a second (expensive) pass over the connectivity. The data is moved rather than copied, so src is left without a schedule and must not be used for communication afterwards (it can still be freed). No communication resources are set up here; complete the handover with init_schedule once src has been freed, so that the two backends never hold their resources at the same time.
 
procedure, pass(this) init_schedule (this)
 Set up this communication method for the schedule taken over by take_schedule. Collective, as init is.
 
procedure, pass(this) init_vec (this)
 Fused vector halo exchange. Default implementations abort; backends that set vec_supported = .true. override them.
 
procedure, pass(this) nbsend_vec (this, u, n, nc, tag, deps, strm)
 Default fused vector send. Abort unless a backend overrides it.
 
procedure, pass(this) nbrecv_vec (this, tag, nc)
 Default fused vector receive. Abort unless a backend overrides it.
 
procedure, pass(this) nbwait_vec (this, u, n, nc, op, strm)
 Default fused vector wait/reduce. Abort unless a backend overrides it.
 

Public Attributes

real(kind=rp), dimension(:), allocatable send_buf
 Origin buffer for the puts. Plain local memory, no window needed.
 
integer, dimension(:), allocatable send_ndofs
 Number of dofs to send to each peer, in send_pe order.
 
integer, dimension(:), allocatable send_offset
 Offset of each peer's slab in send_buf (scalar path units)
 
integer, dimension(:), allocatable send_rdisp
 Offset of our slab in each peer's receive window (scalar path units), exchanged at init.
 
type(mpi_win) win_data
 Receive window, holding GS_VEC_NC*recv_total reals.
 
type(c_ptr) recv_ptr = C_NULL_PTR
 Base of the receive window.
 
integer, dimension(:), allocatable recv_ndofs
 Number of dofs received from each peer, in recv_pe order.
 
integer, dimension(:), allocatable recv_offset
 Offset of each peer's slab in the receive window (scalar path units)
 
integer recv_total = 0
 Total number of received dofs on this rank.
 
type(mpi_win) win_sig
 Signal window, 2*pe_size counters (data signals then acks)
 
type(c_ptr) sig_ptr = C_NULL_PTR
 Base of the signal window.
 
integer(kind=i8) iter = 0
 Monotonically increasing round counter. The sender replaces the receiver's data signal with it; the receiver replaces the sender's ack with the same value once consumed.
 
logical unified = .true.
 Whether the windows use MPI_WIN_UNIFIED. In the separate memory model a remote update is only guaranteed visible to a local load after MPI_Win_sync, so the spin waits call it every iteration.
 
logical win_alloc = .false.
 Whether the windows have been allocated, so free can tell a live backend from one that never got past init.
 
type(stack_i4_t), dimension(:), allocatable send_dof
 A list of stacks of dof indices local to this process to send to rank_i.
 
type(stack_i4_t), dimension(:), allocatable recv_dof
 recv_dof(rank_i) is a stack of dof indices local to this process to receive from rank_i. size(recv_dof) == pe_size
 
integer, dimension(:), allocatable send_pe
 Array of ranks that this process should send to.
 
integer, dimension(:), allocatable recv_pe
 array of ranks that this process will receive messages from
 
logical vec_supported = .false.
 Whether this backend implements the fused vector (multi-component) halo exchange (nbsend_vec/nbrecv_vec/nbwait_vec). When .false., the gs_op_r3 caller falls back to nc independent scalar exchanges.
 
logical vec_ready = .false.
 Whether the buffers the fused vector exchange needs are in place. They are sized GS_VEC_NC times the halo, quadrupling what the backend holds, and only gs_op_r3 ever touches them, so a backend that can allocate them on its own defers that to the first fused exchange (see init_vec) rather than paying for it in every run. A backend whose vector buffers are part of an allocation the whole run has to agree on – symmetric memory, coarrays, registered memory, an RMA window – cannot defer, since a rank with no shared dofs never reaches the first fused exchange; those allocate in init and set this there.
 

Detailed Description

Definition at line 73 of file gs_mpi_rma.f90.

Member Function/Subroutine Documentation

◆ free() [1/2]

procedure, pass(this) gs_mpi_rma::gs_mpi_rma_t::free ( class(gs_mpi_rma_t), intent(inout)  this)

Definition at line 115 of file gs_mpi_rma.f90.

◆ free() [2/2]

procedure(gs_comm_free), deferred, pass gs_comm::gs_comm_t::free
pure virtualinherited

Definition at line 82 of file gs_comm.f90.

◆ free_dofs()

procedure, pass(this) gs_comm::gs_comm_t::free_dofs ( class(gs_comm_t), intent(inout)  this)
inherited

Definition at line 87 of file gs_comm.f90.

◆ free_order()

procedure, pass(this) gs_comm::gs_comm_t::free_order ( class(gs_comm_t), intent(inout)  this)
inherited

Definition at line 89 of file gs_comm.f90.

◆ init() [1/2]

procedure, pass(this) gs_mpi_rma::gs_mpi_rma_t::init ( class(gs_mpi_rma_t), intent(inout)  this,
type(stack_i4_t), intent(inout)  send_pe,
type(stack_i4_t), intent(inout)  recv_pe 
)

Definition at line 114 of file gs_mpi_rma.f90.

◆ init() [2/2]

procedure(gs_comm_init), deferred, pass gs_comm::gs_comm_t::init
pure virtualinherited

Definition at line 81 of file gs_comm.f90.

◆ init_dofs()

procedure, pass(this) gs_comm::gs_comm_t::init_dofs ( class(gs_comm_t), intent(inout)  this)
inherited

Definition at line 86 of file gs_comm.f90.

◆ init_order()

procedure, pass(this) gs_comm::gs_comm_t::init_order ( class(gs_comm_t), intent(inout)  this,
type(stack_i4_t), intent(inout)  send_pe,
type(stack_i4_t), intent(inout)  recv_pe 
)
inherited
Parameters
send_pe,onlycontains rank ids this porcesss should send to
recv_pe,onlythe ranks this process should receive from

Definition at line 88 of file gs_comm.f90.

◆ init_schedule()

procedure, pass(this) gs_comm::gs_comm_t::init_schedule ( class(gs_comm_t), intent(inout)  this)
inherited

Definition at line 91 of file gs_comm.f90.

◆ init_vec()

procedure, pass(this) gs_comm::gs_comm_t::init_vec ( class(gs_comm_t), intent(inout)  this)
inherited
Note
Rank local by contract: a rank with no shared dofs skips the fused exchange entirely, so an override must not communicate.

Definition at line 94 of file gs_comm.f90.

◆ nbrecv() [1/2]

procedure, pass(this) gs_mpi_rma::gs_mpi_rma_t::nbrecv ( class(gs_mpi_rma_t), intent(inout)  this,
integer, intent(in)  tag 
)

Definition at line 117 of file gs_mpi_rma.f90.

◆ nbrecv() [2/2]

procedure(gs_nbrecv), deferred, pass gs_comm::gs_comm_t::nbrecv
pure virtualinherited

Definition at line 84 of file gs_comm.f90.

◆ nbrecv_vec() [1/2]

procedure, pass(this) gs_comm::gs_comm_t::nbrecv_vec ( class(gs_comm_t), intent(inout)  this,
integer, intent(in)  tag,
integer, intent(in)  nc 
)
inherited

Definition at line 96 of file gs_comm.f90.

◆ nbrecv_vec() [2/2]

procedure, pass(this) gs_mpi_rma::gs_mpi_rma_t::nbrecv_vec ( class(gs_mpi_rma_t), intent(inout)  this,
integer, intent(in)  tag,
integer, intent(in)  nc 
)

Definition at line 120 of file gs_mpi_rma.f90.

◆ nbsend() [1/2]

procedure, pass(this) gs_mpi_rma::gs_mpi_rma_t::nbsend ( class(gs_mpi_rma_t), intent(inout)  this,
real(kind=rp), dimension(n), intent(inout)  u,
integer, intent(in)  n,
integer, intent(in)  tag,
type(c_ptr), intent(inout)  deps,
type(c_ptr), intent(inout)  strm 
)

Definition at line 116 of file gs_mpi_rma.f90.

◆ nbsend() [2/2]

procedure(gs_nbsend), deferred, pass gs_comm::gs_comm_t::nbsend
pure virtualinherited

Definition at line 83 of file gs_comm.f90.

◆ nbsend_vec() [1/2]

procedure, pass(this) gs_comm::gs_comm_t::nbsend_vec ( class(gs_comm_t), intent(inout)  this,
real(kind=rp), dimension(nc*n), intent(inout)  u,
integer, intent(in)  n,
integer, intent(in)  nc,
integer, intent(in)  tag,
type(c_ptr), intent(inout)  deps,
type(c_ptr), intent(inout)  strm 
)
inherited
Parameters
ucompact shared buffer, component-outer: u((c-1)*n + idx)
nnumber of shared dofs (per component)
ncnumber of components

Definition at line 95 of file gs_comm.f90.

◆ nbsend_vec() [2/2]

procedure, pass(this) gs_mpi_rma::gs_mpi_rma_t::nbsend_vec ( class(gs_mpi_rma_t), intent(inout)  this,
real(kind=rp), dimension(nc*n), intent(inout)  u,
integer, intent(in)  n,
integer, intent(in)  nc,
integer, intent(in)  tag,
type(c_ptr), intent(inout)  deps,
type(c_ptr), intent(inout)  strm 
)
Parameters
ucompact shared buffer, component-outer: u((c-1)*n + idx).

Definition at line 119 of file gs_mpi_rma.f90.

◆ nbwait() [1/2]

procedure, pass(this) gs_mpi_rma::gs_mpi_rma_t::nbwait ( class(gs_mpi_rma_t), intent(inout)  this,
real(kind=rp), dimension(n), intent(inout)  u,
integer, intent(in)  n,
integer  op,
type(c_ptr), intent(inout)  strm 
)

Definition at line 118 of file gs_mpi_rma.f90.

◆ nbwait() [2/2]

procedure(gs_nbwait), deferred, pass gs_comm::gs_comm_t::nbwait
pure virtualinherited

Definition at line 85 of file gs_comm.f90.

◆ nbwait_vec() [1/2]

procedure, pass(this) gs_comm::gs_comm_t::nbwait_vec ( class(gs_comm_t), intent(inout)  this,
real(kind=rp), dimension(nc*n), intent(inout)  u,
integer, intent(in)  n,
integer, intent(in)  nc,
integer  op,
type(c_ptr), intent(inout)  strm 
)
inherited

Definition at line 97 of file gs_comm.f90.

◆ nbwait_vec() [2/2]

procedure, pass(this) gs_mpi_rma::gs_mpi_rma_t::nbwait_vec ( class(gs_mpi_rma_t), intent(inout)  this,
real(kind=rp), dimension(nc*n), intent(inout)  u,
integer, intent(in)  n,
integer, intent(in)  nc,
integer  op,
type(c_ptr), intent(inout)  strm 
)

Definition at line 121 of file gs_mpi_rma.f90.

◆ take_schedule()

procedure, pass(this) gs_comm::gs_comm_t::take_schedule ( class(gs_comm_t), intent(inout)  this,
class(gs_comm_t), intent(inout)  src 
)
inherited
Parameters
srcthe backend to take the schedule from, left without one

Definition at line 90 of file gs_comm.f90.

Member Data Documentation

◆ iter

integer(kind=i8) gs_mpi_rma::gs_mpi_rma_t::iter = 0

Definition at line 103 of file gs_mpi_rma.f90.

◆ recv_dof

type(stack_i4_t), dimension(:), allocatable gs_comm::gs_comm_t::recv_dof
inherited

Definition at line 58 of file gs_comm.f90.

◆ recv_ndofs

integer, dimension(:), allocatable gs_mpi_rma::gs_mpi_rma_t::recv_ndofs

Definition at line 89 of file gs_mpi_rma.f90.

◆ recv_offset

integer, dimension(:), allocatable gs_mpi_rma::gs_mpi_rma_t::recv_offset

Definition at line 91 of file gs_mpi_rma.f90.

◆ recv_pe

integer, dimension(:), allocatable gs_comm::gs_comm_t::recv_pe
inherited

Definition at line 64 of file gs_comm.f90.

◆ recv_ptr

type(c_ptr) gs_mpi_rma::gs_mpi_rma_t::recv_ptr = C_NULL_PTR

Definition at line 87 of file gs_mpi_rma.f90.

◆ recv_total

integer gs_mpi_rma::gs_mpi_rma_t::recv_total = 0

Definition at line 93 of file gs_mpi_rma.f90.

◆ send_buf

real(kind=rp), dimension(:), allocatable gs_mpi_rma::gs_mpi_rma_t::send_buf

Definition at line 75 of file gs_mpi_rma.f90.

◆ send_dof

type(stack_i4_t), dimension(:), allocatable gs_comm::gs_comm_t::send_dof
inherited

Definition at line 55 of file gs_comm.f90.

◆ send_ndofs

integer, dimension(:), allocatable gs_mpi_rma::gs_mpi_rma_t::send_ndofs

Definition at line 77 of file gs_mpi_rma.f90.

◆ send_offset

integer, dimension(:), allocatable gs_mpi_rma::gs_mpi_rma_t::send_offset

Definition at line 79 of file gs_mpi_rma.f90.

◆ send_pe

integer, dimension(:), allocatable gs_comm::gs_comm_t::send_pe
inherited
Note
: this will usually be fewer than the total number of ranks size(send_pe) <= pe_size

Definition at line 62 of file gs_comm.f90.

◆ send_rdisp

integer, dimension(:), allocatable gs_mpi_rma::gs_mpi_rma_t::send_rdisp

Definition at line 82 of file gs_mpi_rma.f90.

◆ sig_ptr

type(c_ptr) gs_mpi_rma::gs_mpi_rma_t::sig_ptr = C_NULL_PTR

Definition at line 98 of file gs_mpi_rma.f90.

◆ unified

logical gs_mpi_rma::gs_mpi_rma_t::unified = .true.

Definition at line 108 of file gs_mpi_rma.f90.

◆ vec_ready

logical gs_comm::gs_comm_t::vec_ready = .false.
inherited

Definition at line 79 of file gs_comm.f90.

◆ vec_supported

logical gs_comm::gs_comm_t::vec_supported = .false.
inherited

Definition at line 68 of file gs_comm.f90.

◆ win_alloc

logical gs_mpi_rma::gs_mpi_rma_t::win_alloc = .false.

Definition at line 112 of file gs_mpi_rma.f90.

◆ win_data

type(mpi_win) gs_mpi_rma::gs_mpi_rma_t::win_data

Definition at line 85 of file gs_mpi_rma.f90.

◆ win_sig

type(mpi_win) gs_mpi_rma::gs_mpi_rma_t::win_sig

Definition at line 96 of file gs_mpi_rma.f90.


The documentation for this type was generated from the following file: