38 use,
intrinsic :: iso_c_binding, only : c_ptr
44 real(kind=
rp),
allocatable :: local_wrk(:)
45 real(kind=
rp),
allocatable :: shared_wrk(:)
58 subroutine gs_sx_init(this, nlocal, nshared, nlcl_blks, nshrd_blks)
59 class(
gs_sx_t),
intent(inout) :: this
60 integer,
intent(in) :: nlocal
61 integer,
intent(in) :: nshared
62 integer,
intent(in) :: nlcl_blks
63 integer,
intent(in) :: nshrd_blks
68 this%nshared = nshared
70 allocate(this%local_wrk(nlocal))
71 allocate(this%shared_wrk(nshared))
77 class(
gs_sx_t),
intent(inout) :: this
79 if (
allocated(this%local_wrk))
then
80 deallocate(this%local_wrk)
83 if (
allocated(this%shared_wrk))
then
84 deallocate(this%shared_wrk)
93 subroutine gs_gather_sx(this, v, m, o, dg, u, n, gd, nb, b, bo, op, shrd)
94 integer,
intent(in) :: m
95 integer,
intent(in) :: n
96 integer,
intent(in) :: nb
97 class(
gs_sx_t),
intent(inout) :: this
98 real(kind=
rp),
dimension(m),
intent(inout) :: v
99 integer,
dimension(m),
intent(inout) :: dg
100 real(kind=
rp),
dimension(n),
intent(inout) :: u
101 integer,
dimension(m),
intent(inout) :: gd
102 integer,
dimension(nb),
intent(inout) :: b
103 integer,
dimension(nb),
intent(inout) :: bo
104 integer,
intent(in) :: o
105 integer,
intent(in) :: op
106 logical,
intent(in) :: shrd
109 associate(w=>this%local_wrk)
122 associate(w=>this%shared_wrk)
141 integer,
intent(in) :: m
142 integer,
intent(in) :: n
143 integer,
intent(in) :: nb
144 real(kind=rp),
dimension(m),
intent(inout) :: v
145 real(kind=rp),
dimension(m),
intent(inout) :: w
146 integer,
dimension(m),
intent(inout) :: dg
147 real(kind=rp),
dimension(n),
intent(inout) :: u
148 integer,
dimension(m),
intent(inout) :: gd
149 integer,
dimension(nb),
intent(inout) :: b
150 integer,
intent(in) :: o
160 v(dg(i)) = v(dg(i)) + w(i)
169 tmp = u(gd(i)) + u(gd(i+1))
179 integer,
intent(in) :: m
180 integer,
intent(in) :: n
181 integer,
intent(in) :: nb
182 real(kind=rp),
dimension(m),
intent(inout) :: v
183 real(kind=rp),
dimension(m),
intent(inout) :: w
184 integer,
dimension(m),
intent(inout) :: dg
185 real(kind=rp),
dimension(n),
intent(inout) :: u
186 integer,
dimension(m),
intent(inout) :: gd
187 integer,
dimension(nb),
intent(inout) :: b
188 integer,
intent(in) :: o
198 v(dg(i)) = v(dg(i)) * w(i)
207 tmp = u(gd(i)) * u(gd(i+1))
217 integer,
intent(in) :: m
218 integer,
intent(in) :: n
219 integer,
intent(in) :: nb
220 real(kind=rp),
dimension(m),
intent(inout) :: v
221 real(kind=rp),
dimension(m),
intent(inout) :: w
222 integer,
dimension(m),
intent(inout) :: dg
223 real(kind=rp),
dimension(n),
intent(inout) :: u
224 integer,
dimension(m),
intent(inout) :: gd
225 integer,
dimension(nb),
intent(inout) :: b
226 integer,
intent(in) :: o
236 v(dg(i)) = min(v(dg(i)), w(i))
245 tmp = min(u(gd(i)), u(gd(i+1)))
255 integer,
intent(in) :: m
256 integer,
intent(in) :: n
257 integer,
intent(in) :: nb
258 real(kind=rp),
dimension(m),
intent(inout) :: v
259 real(kind=rp),
dimension(m),
intent(inout) :: w
260 integer,
dimension(m),
intent(inout) :: dg
261 real(kind=rp),
dimension(n),
intent(inout) :: u
262 integer,
dimension(m),
intent(inout) :: gd
263 integer,
dimension(nb),
intent(inout) :: b
264 integer,
intent(in) :: o
274 v(dg(i)) =
max(v(dg(i)), w(i))
283 tmp =
max(u(gd(i)), u(gd(i+1)))
291 subroutine gs_scatter_sx(this, v, m, dg, u, n, gd, nb, b, bo, shrd, event)
292 integer,
intent(in) :: m
293 integer,
intent(in) :: n
294 integer,
intent(in) :: nb
295 class(
gs_sx_t),
intent(inout) :: this
296 real(kind=rp),
dimension(m),
intent(inout) :: v
297 integer,
dimension(m),
intent(inout) :: dg
298 real(kind=rp),
dimension(n),
intent(inout) :: u
299 integer,
dimension(m),
intent(inout) :: gd
300 integer,
dimension(nb),
intent(inout) :: b
301 integer,
dimension(nb),
intent(inout) :: bo
302 logical,
intent(in) :: shrd
315 integer,
intent(in) :: m
316 integer,
intent(in) :: n
317 integer,
intent(in) :: nb
318 real(kind=rp),
dimension(m),
intent(inout) :: v
319 real(kind=rp),
dimension(m),
intent(inout) :: w
320 integer,
dimension(m),
intent(inout) :: dg
321 real(kind=rp),
dimension(n),
intent(inout) :: u
322 integer,
dimension(m),
intent(inout) :: gd
323 integer,
dimension(nb),
intent(inout) :: b
Defines a gather-scatter backend.
Defines Gather-scatter operations.
integer, parameter, public gs_op_add
integer, parameter, public gs_op_max
integer, parameter, public gs_op_min
integer, parameter, public gs_op_mul
Generic Gather-scatter backend for NEC Vector Engines.
subroutine gs_gather_kernel_mul(v, m, o, dg, u, n, gd, nb, b, w)
Gather kernel for multiplication of data .
subroutine gs_gather_kernel_max(v, m, o, dg, u, n, gd, nb, b, w)
Gather kernel for maximum of data .
subroutine gs_scatter_sx(this, v, m, dg, u, n, gd, nb, b, bo, shrd, event)
Scatter kernel.
subroutine gs_gather_kernel_min(v, m, o, dg, u, n, gd, nb, b, w)
Gather kernel for minimum of data .
subroutine gs_gather_sx(this, v, m, o, dg, u, n, gd, nb, b, bo, op, shrd)
Gather kernel.
subroutine gs_sx_free(this)
SX backend deallocation.
subroutine gs_gather_kernel_add(v, m, o, dg, u, n, gd, nb, b, w)
Gather kernel for addition of data .
subroutine gs_scatter_kernel(v, m, dg, u, n, gd, nb, b, w)
Scatter kernel .
subroutine gs_sx_init(this, nlocal, nshared, nlcl_blks, nshrd_blks)
SX backend initialisation.
integer, parameter, public rp
Global precision used in computations.
Gather-scatter backend for NEC SX-Aurora.