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, 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,
intent(in) :: o
104 integer,
intent(in) :: op
105 logical,
intent(in) :: shrd
108 associate(w=>this%local_wrk)
121 associate(w=>this%shared_wrk)
140 integer,
intent(in) :: m
141 integer,
intent(in) :: n
142 integer,
intent(in) :: nb
143 real(kind=rp),
dimension(m),
intent(inout) :: v
144 real(kind=rp),
dimension(m),
intent(inout) :: w
145 integer,
dimension(m),
intent(inout) :: dg
146 real(kind=rp),
dimension(n),
intent(inout) :: u
147 integer,
dimension(m),
intent(inout) :: gd
148 integer,
dimension(nb),
intent(inout) :: b
149 integer,
intent(in) :: o
159 v(dg(i)) = v(dg(i)) + w(i)
168 tmp = u(gd(i)) + u(gd(i+1))
178 integer,
intent(in) :: m
179 integer,
intent(in) :: n
180 integer,
intent(in) :: nb
181 real(kind=rp),
dimension(m),
intent(inout) :: v
182 real(kind=rp),
dimension(m),
intent(inout) :: w
183 integer,
dimension(m),
intent(inout) :: dg
184 real(kind=rp),
dimension(n),
intent(inout) :: u
185 integer,
dimension(m),
intent(inout) :: gd
186 integer,
dimension(nb),
intent(inout) :: b
187 integer,
intent(in) :: o
196 v(dg(i)) = v(dg(i)) * w(i)
205 tmp = u(gd(i)) * u(gd(i+1))
215 integer,
intent(in) :: m
216 integer,
intent(in) :: n
217 integer,
intent(in) :: nb
218 real(kind=rp),
dimension(m),
intent(inout) :: v
219 real(kind=rp),
dimension(m),
intent(inout) :: w
220 integer,
dimension(m),
intent(inout) :: dg
221 real(kind=rp),
dimension(n),
intent(inout) :: u
222 integer,
dimension(m),
intent(inout) :: gd
223 integer,
dimension(nb),
intent(inout) :: b
224 integer,
intent(in) :: o
233 v(dg(i)) = min(v(dg(i)), w(i))
242 tmp = min(u(gd(i)), u(gd(i+1)))
252 integer,
intent(in) :: m
253 integer,
intent(in) :: n
254 integer,
intent(in) :: nb
255 real(kind=rp),
dimension(m),
intent(inout) :: v
256 real(kind=rp),
dimension(m),
intent(inout) :: w
257 integer,
dimension(m),
intent(inout) :: dg
258 real(kind=rp),
dimension(n),
intent(inout) :: u
259 integer,
dimension(m),
intent(inout) :: gd
260 integer,
dimension(nb),
intent(inout) :: b
261 integer,
intent(in) :: o
270 v(dg(i)) =
max(v(dg(i)), w(i))
279 tmp =
max(u(gd(i)), u(gd(i+1)))
287 subroutine gs_scatter_sx(this, v, m, dg, u, n, gd, nb, b, shrd, event)
288 integer,
intent(in) :: m
289 integer,
intent(in) :: n
290 integer,
intent(in) :: nb
291 class(
gs_sx_t),
intent(inout) :: this
292 real(kind=rp),
dimension(m),
intent(inout) :: v
293 integer,
dimension(m),
intent(inout) :: dg
294 real(kind=rp),
dimension(n),
intent(inout) :: u
295 integer,
dimension(m),
intent(inout) :: gd
296 integer,
dimension(nb),
intent(inout) :: b
297 logical,
intent(in) :: shrd
310 integer,
intent(in) :: m
311 integer,
intent(in) :: n
312 integer,
intent(in) :: nb
313 real(kind=rp),
dimension(m),
intent(inout) :: v
314 real(kind=rp),
dimension(m),
intent(inout) :: w
315 integer,
dimension(m),
intent(inout) :: dg
316 real(kind=rp),
dimension(n),
intent(inout) :: u
317 integer,
dimension(m),
intent(inout) :: gd
318 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_sx(this, v, m, o, dg, u, n, gd, nb, b, op, shrd)
Gather kernel.
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_gather_kernel_min(v, m, o, dg, u, n, gd, nb, b, w)
Gather kernel for minimum of data .
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.
subroutine gs_scatter_sx(this, v, m, dg, u, n, gd, nb, b, shrd, event)
Scatter kernel.
integer, parameter, public rp
Global precision used in computations.
Gather-scatter backend for NEC SX-Aurora.