39 use,
intrinsic :: iso_c_binding
61 integer,
allocatable :: send_pe(:)
63 integer,
allocatable :: recv_pe(:)
67 logical :: vec_supported = .false.
71 procedure(
gs_nbsend), pass(this),
deferred :: nbsend
72 procedure(
gs_nbrecv), pass(this),
deferred :: nbrecv
73 procedure(
gs_nbwait), pass(this),
deferred :: nbwait
121 integer,
intent(in) :: n
122 real(kind=
rp),
dimension(n),
intent(inout) :: u
123 integer,
intent(in) :: tag
124 type(c_ptr),
intent(inout) :: deps
125 type(c_ptr),
intent(inout) :: strm
136 integer,
intent(in) :: tag
155 integer,
intent(in) :: n
156 real(kind=
rp),
dimension(n),
intent(inout) :: u
158 type(c_ptr),
intent(inout) :: strm
169 call this%free_dofs()
171 allocate(this%send_dof(0:
pe_size-1))
172 allocate(this%recv_dof(0:
pe_size-1))
175 call this%send_dof(i)%init()
176 call this%recv_dof(i)%init()
185 if (
allocated(this%send_dof))
then
187 call this%send_dof(i)%free()
189 deallocate(this%send_dof)
192 if (
allocated(this%recv_dof))
then
194 call this%recv_dof(i)%free()
196 deallocate(this%recv_dof)
208 integer,
pointer :: sp(:)
211 allocate(this%send_pe(send_pe%size()))
213 sp => send_pe%array()
214 do i = 1, send_pe%size()
215 this%send_pe(i) = sp(i)
218 allocate(this%recv_pe(recv_pe%size()))
220 sp => recv_pe%array()
221 do i = 1, recv_pe%size()
222 this%recv_pe(i) = sp(i)
230 if (
allocated(this%send_pe))
then
231 deallocate(this%send_pe)
234 if (
allocated(this%recv_pe))
then
235 deallocate(this%recv_pe)
252 if (.not.
allocated(src%send_dof) .or. .not.
allocated(src%recv_dof) .or. &
253 .not.
allocated(src%send_pe) .or. .not.
allocated(src%recv_pe))
then
254 call neko_error(
'Gather-scatter comm. method has no schedule')
257 call this%free_dofs()
258 call this%free_order()
260 call move_alloc(src%send_dof, this%send_dof)
261 call move_alloc(src%recv_dof, this%recv_dof)
262 call move_alloc(src%send_pe, this%send_pe)
263 call move_alloc(src%recv_pe, this%recv_pe)
272 integer,
allocatable :: sp(:), rp(:)
275 if (.not.
allocated(this%send_pe) .or. .not.
allocated(this%recv_pe))
then
276 call neko_error(
'Gather-scatter comm. method has no schedule')
281 call move_alloc(this%send_pe, sp)
282 call move_alloc(this%recv_pe, rp)
284 call send_pe%init(
max(
size(sp), 1))
287 call send_pe%push(pe)
290 call recv_pe%init(
max(
size(rp), 1))
293 call recv_pe%push(pe)
298 call this%init(send_pe, recv_pe)
311 integer,
intent(in) :: n, nc
312 real(kind=
rp),
dimension(nc*n),
intent(inout) :: u
313 integer,
intent(in) :: tag
314 type(c_ptr),
intent(inout) :: deps
315 type(c_ptr),
intent(inout) :: strm
316 call neko_error(
'Vector gather-scatter not supported by this comm backend')
322 integer,
intent(in) :: tag, nc
323 call neko_error(
'Vector gather-scatter not supported by this comm backend')
329 integer,
intent(in) :: n, nc
330 real(kind=
rp),
dimension(nc*n),
intent(inout) :: u
332 type(c_ptr),
intent(inout) :: strm
333 call neko_error(
'Vector gather-scatter not supported by this comm backend')
Abstract interface for deallocating a Gather-scatter communication method.
Abstract interface for initializing a Gather-scatter communication method.
Abstract interface for initiating non-blocking recieve operations Posts non-blocking recieve of value...
Abstract interface for initiating non-blocking send operations Sends the values in u(send_dof(send_pe...
Abstract interface for waiting on non-blocking operations Waits and checks that data is in buffers an...
integer, public pe_size
MPI size of communicator.
Defines a gather-scatter communication method.
subroutine init_schedule(this)
Set up this communication method for the schedule taken over by take_schedule. Collective,...
subroutine gs_nbsend_vec(this, u, n, nc, tag, deps, strm)
Default fused vector send. Abort unless a backend overrides it.
subroutine init_dofs(this)
subroutine gs_nbrecv_vec(this, tag, nc)
Default fused vector receive. Abort unless a backend overrides it.
integer, parameter, public gs_vec_nc
Maximum number of components handled by the fused vector (multi-component) halo exchange used by gs_o...
integer, parameter, public gs_comm_mpigpu
subroutine take_schedule(this, src)
Take over the gather-scatter schedule (dof lists and peer order) of src, avoiding a second (expensive...
integer, parameter, public gs_comm_neighbour
integer, parameter, public gs_comm_mpi
subroutine init_order(this, send_pe, recv_pe)
Obtains which ranks to send and receive data from.
subroutine gs_nbwait_vec(this, u, n, nc, op, strm)
Default fused vector wait/reduce. Abort unless a backend overrides it.
integer, parameter, public gs_comm_nvshmem
integer, parameter, public gs_comm_openshmem
integer, parameter, public gs_comm_utofu
subroutine free_dofs(this)
integer, parameter, public gs_comm_nccl
subroutine free_order(this)
integer, parameter, public gs_comm_caf
integer, parameter, public rp
Global precision used in computations.
Implements a dynamic stack ADT.
Gather-scatter communication method.