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
197 v(dg(i)) = v(dg(i)) * w(i)
206 tmp = u(gd(i)) * u(gd(i+1))
216 integer,
intent(in) :: m
217 integer,
intent(in) :: n
218 integer,
intent(in) :: nb
219 real(kind=rp),
dimension(m),
intent(inout) :: v
220 real(kind=rp),
dimension(m),
intent(inout) :: w
221 integer,
dimension(m),
intent(inout) :: dg
222 real(kind=rp),
dimension(n),
intent(inout) :: u
223 integer,
dimension(m),
intent(inout) :: gd
224 integer,
dimension(nb),
intent(inout) :: b
225 integer,
intent(in) :: o
234 v(dg(i)) = min(v(dg(i)), w(i))
243 tmp = min(u(gd(i)), u(gd(i+1)))
253 integer,
intent(in) :: m
254 integer,
intent(in) :: n
255 integer,
intent(in) :: nb
256 real(kind=rp),
dimension(m),
intent(inout) :: v
257 real(kind=rp),
dimension(m),
intent(inout) :: w
258 integer,
dimension(m),
intent(inout) :: dg
259 real(kind=rp),
dimension(n),
intent(inout) :: u
260 integer,
dimension(m),
intent(inout) :: gd
261 integer,
dimension(nb),
intent(inout) :: b
262 integer,
intent(in) :: o
271 v(dg(i)) =
max(v(dg(i)), w(i))
280 tmp =
max(u(gd(i)), u(gd(i+1)))
288 subroutine gs_scatter_sx(this, v, m, dg, u, n, gd, nb, b, bo, shrd, event)
289 integer,
intent(in) :: m
290 integer,
intent(in) :: n
291 integer,
intent(in) :: nb
292 class(
gs_sx_t),
intent(inout) :: this
293 real(kind=rp),
dimension(m),
intent(inout) :: v
294 integer,
dimension(m),
intent(inout) :: dg
295 real(kind=rp),
dimension(n),
intent(inout) :: u
296 integer,
dimension(m),
intent(inout) :: gd
297 integer,
dimension(nb),
intent(inout) :: b
298 integer,
dimension(nb),
intent(inout) :: bo
299 logical,
intent(in) :: shrd
312 integer,
intent(in) :: m
313 integer,
intent(in) :: n
314 integer,
intent(in) :: nb
315 real(kind=rp),
dimension(m),
intent(inout) :: v
316 real(kind=rp),
dimension(m),
intent(inout) :: w
317 integer,
dimension(m),
intent(inout) :: dg
318 real(kind=rp),
dimension(n),
intent(inout) :: u
319 integer,
dimension(m),
intent(inout) :: gd
320 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.