39 use,
intrinsic :: iso_c_binding
62 integer,
allocatable :: send_pe(:)
64 integer,
allocatable :: recv_pe(:)
68 logical :: vec_supported = .false.
79 logical :: vec_ready = .false.
83 procedure(
gs_nbsend), pass(this),
deferred :: nbsend
84 procedure(
gs_nbrecv), pass(this),
deferred :: nbrecv
85 procedure(
gs_nbwait), pass(this),
deferred :: nbwait
134 integer,
intent(in) :: n
135 real(kind=
rp),
dimension(n),
intent(inout) :: u
136 integer,
intent(in) :: tag
137 type(c_ptr),
intent(inout) :: deps
138 type(c_ptr),
intent(inout) :: strm
149 integer,
intent(in) :: tag
168 integer,
intent(in) :: n
169 real(kind=
rp),
dimension(n),
intent(inout) :: u
171 type(c_ptr),
intent(inout) :: strm
182 call this%free_dofs()
184 allocate(this%send_dof(0:
pe_size-1))
185 allocate(this%recv_dof(0:
pe_size-1))
188 call this%send_dof(i)%init()
189 call this%recv_dof(i)%init()
198 if (
allocated(this%send_dof))
then
200 call this%send_dof(i)%free()
202 deallocate(this%send_dof)
205 if (
allocated(this%recv_dof))
then
207 call this%recv_dof(i)%free()
209 deallocate(this%recv_dof)
221 integer,
pointer :: sp(:)
224 allocate(this%send_pe(send_pe%size()))
226 sp => send_pe%array()
227 do i = 1, send_pe%size()
228 this%send_pe(i) = sp(i)
231 allocate(this%recv_pe(recv_pe%size()))
233 sp => recv_pe%array()
234 do i = 1, recv_pe%size()
235 this%recv_pe(i) = sp(i)
243 if (
allocated(this%send_pe))
then
244 deallocate(this%send_pe)
247 if (
allocated(this%recv_pe))
then
248 deallocate(this%recv_pe)
265 if (.not.
allocated(src%send_dof) .or. .not.
allocated(src%recv_dof) .or. &
266 .not.
allocated(src%send_pe) .or. .not.
allocated(src%recv_pe))
then
267 call neko_error(
'Gather-scatter comm. method has no schedule')
270 call this%free_dofs()
271 call this%free_order()
273 call move_alloc(src%send_dof, this%send_dof)
274 call move_alloc(src%recv_dof, this%recv_dof)
275 call move_alloc(src%send_pe, this%send_pe)
276 call move_alloc(src%recv_pe, this%recv_pe)
285 integer,
allocatable :: sp(:), rp(:)
288 if (.not.
allocated(this%send_pe) .or. .not.
allocated(this%recv_pe))
then
289 call neko_error(
'Gather-scatter comm. method has no schedule')
294 call move_alloc(this%send_pe, sp)
295 call move_alloc(this%recv_pe, rp)
297 call send_pe%init(
max(
size(sp), 1))
300 call send_pe%push(pe)
303 call recv_pe%init(
max(
size(rp), 1))
306 call recv_pe%push(pe)
311 call this%init(send_pe, recv_pe)
326 call neko_error(
'Vector gather-scatter not supported by this comm backend')
335 integer,
intent(in) :: n, nc
336 real(kind=
rp),
dimension(nc*n),
intent(inout) :: u
337 integer,
intent(in) :: tag
338 type(c_ptr),
intent(inout) :: deps
339 type(c_ptr),
intent(inout) :: strm
340 call neko_error(
'Vector gather-scatter not supported by this comm backend')
346 integer,
intent(in) :: tag, nc
347 call neko_error(
'Vector gather-scatter not supported by this comm backend')
353 integer,
intent(in) :: n, nc
354 real(kind=
rp),
dimension(nc*n),
intent(inout) :: u
356 type(c_ptr),
intent(inout) :: strm
357 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.
integer, parameter, public gs_comm_mpirma
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_crystal
integer, parameter, public gs_comm_mpigpu
integer, parameter, public gs_comm_crystalgpu
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 gs_init_vec(this)
Default deferred allocation of the fused vector buffers. Reached only on a backend that advertises ve...
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.