39 use,
intrinsic :: iso_c_binding
62 integer,
allocatable :: send_pe(:)
64 integer,
allocatable :: recv_pe(:)
68 logical :: vec_supported = .false.
72 procedure(
gs_nbsend), pass(this),
deferred :: nbsend
73 procedure(
gs_nbrecv), pass(this),
deferred :: nbrecv
74 procedure(
gs_nbwait), pass(this),
deferred :: nbwait
122 integer,
intent(in) :: n
123 real(kind=
rp),
dimension(n),
intent(inout) :: u
124 integer,
intent(in) :: tag
125 type(c_ptr),
intent(inout) :: deps
126 type(c_ptr),
intent(inout) :: strm
137 integer,
intent(in) :: tag
156 integer,
intent(in) :: n
157 real(kind=
rp),
dimension(n),
intent(inout) :: u
159 type(c_ptr),
intent(inout) :: strm
170 call this%free_dofs()
172 allocate(this%send_dof(0:
pe_size-1))
173 allocate(this%recv_dof(0:
pe_size-1))
176 call this%send_dof(i)%init()
177 call this%recv_dof(i)%init()
186 if (
allocated(this%send_dof))
then
188 call this%send_dof(i)%free()
190 deallocate(this%send_dof)
193 if (
allocated(this%recv_dof))
then
195 call this%recv_dof(i)%free()
197 deallocate(this%recv_dof)
209 integer,
pointer :: sp(:)
212 allocate(this%send_pe(send_pe%size()))
214 sp => send_pe%array()
215 do i = 1, send_pe%size()
216 this%send_pe(i) = sp(i)
219 allocate(this%recv_pe(recv_pe%size()))
221 sp => recv_pe%array()
222 do i = 1, recv_pe%size()
223 this%recv_pe(i) = sp(i)
231 if (
allocated(this%send_pe))
then
232 deallocate(this%send_pe)
235 if (
allocated(this%recv_pe))
then
236 deallocate(this%recv_pe)
253 if (.not.
allocated(src%send_dof) .or. .not.
allocated(src%recv_dof) .or. &
254 .not.
allocated(src%send_pe) .or. .not.
allocated(src%recv_pe))
then
255 call neko_error(
'Gather-scatter comm. method has no schedule')
258 call this%free_dofs()
259 call this%free_order()
261 call move_alloc(src%send_dof, this%send_dof)
262 call move_alloc(src%recv_dof, this%recv_dof)
263 call move_alloc(src%send_pe, this%send_pe)
264 call move_alloc(src%recv_pe, this%recv_pe)
273 integer,
allocatable :: sp(:), rp(:)
276 if (.not.
allocated(this%send_pe) .or. .not.
allocated(this%recv_pe))
then
277 call neko_error(
'Gather-scatter comm. method has no schedule')
282 call move_alloc(this%send_pe, sp)
283 call move_alloc(this%recv_pe, rp)
285 call send_pe%init(
max(
size(sp), 1))
288 call send_pe%push(pe)
291 call recv_pe%init(
max(
size(rp), 1))
294 call recv_pe%push(pe)
299 call this%init(send_pe, recv_pe)
312 integer,
intent(in) :: n, nc
313 real(kind=
rp),
dimension(nc*n),
intent(inout) :: u
314 integer,
intent(in) :: tag
315 type(c_ptr),
intent(inout) :: deps
316 type(c_ptr),
intent(inout) :: strm
317 call neko_error(
'Vector gather-scatter not supported by this comm backend')
323 integer,
intent(in) :: tag, nc
324 call neko_error(
'Vector gather-scatter not supported by this comm backend')
330 integer,
intent(in) :: n, nc
331 real(kind=
rp),
dimension(nc*n),
intent(inout) :: u
333 type(c_ptr),
intent(inout) :: strm
334 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 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.