Field operation kernels for the OpenMP target backend, following
cuda/kernels/fieldops.f90 and the sum/reorder kernels of
cuda/kernels/reorder.f90.
Arrays are explicit-shape or assumed-size dummies named in
OMP_DEVICE_ADDR (see m_omptgt_common). Pointwise kernels see a field as
a flat array of n points, as the CUDA ones sweep the whole block.
Kernels on the pencil layout index a DIR_X/Y/Z field as (SZ, n, groups) in
the layout of m_ordering, which is not the one the CUDA kernels use: a
DIR_X group index is b = y_block + (z - 1)*n_yb_pad, y-blocks fastest
with n_yb_pad = ny_padded/SZ of them per z station.
Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Functions
public function scalar_product(x, y, n_f, n, n_i, n_groups_pad, n_j) result(s)
public subroutine sgs_stress_from_gradients(stress, nut, gradient_a, gradient_b, scale_a, scale_b, n)
Arguments
Type
Intent
Optional
Attributes
Name
real(kind=dp),
intent(inout)
::
stress(n)
real(kind=dp),
intent(in)
::
nut(n)
real(kind=dp),
intent(in)
::
gradient_a(n)
real(kind=dp),
intent(in)
::
gradient_b(n)
real(kind=dp),
intent(in)
::
scale_a
real(kind=dp),
intent(in)
::
scale_b
integer,
intent(in)
::
n
public subroutine buffer_copy(u_send_s, u_send_e, u, n_u, n, n_groups)
Copies the first and last four points of every line into the start
and end send buffers. n is the line length, n_u the padded extent.
Arguments
Type
Intent
Optional
Attributes
Name
real(kind=dp),
intent(inout)
::
u_send_s(SZ,4,n_groups)
real(kind=dp),
intent(inout)
::
u_send_e(SZ,4,n_groups)
real(kind=dp),
intent(in)
::
u(SZ,n_u,n_groups)
integer,
intent(in)
::
n_u
integer,
intent(in)
::
n
integer,
intent(in)
::
n_groups
public subroutine labelled_sums(s, g, label, a, b, c, n_label, n_f, n, n_i, n_groups_pad, n_j)
s(1:3, l) += sums of ga, gb and g*c over the points labelled l, as
cuda/kernels/fieldops.f90: each thread accumulates runs of equal labels
along its pencil and flushes a run when the label changes, so the
atomics scale with the label changes rather than the points. Atomics
instead of reduction(+:s), which flang cannot do on the GPU for an
array whose shape is only known at run time.
Arguments
Type
Intent
Optional
Attributes
Name
real(kind=dp),
intent(inout)
::
s(3,n_label)
real(kind=dp),
intent(in)
::
g(SZ,n_f,n_groups_pad*n_i)
real(kind=dp),
intent(in)
::
label(SZ,n_f,n_groups_pad*n_i)
real(kind=dp),
intent(in)
::
a(SZ,n_f,n_groups_pad*n_i)
real(kind=dp),
intent(in)
::
b(SZ,n_f,n_groups_pad*n_i)
real(kind=dp),
intent(in)
::
c(SZ,n_f,n_groups_pad*n_i)
integer,
intent(in)
::
n_label
integer,
intent(in)
::
n_f
integer,
intent(in)
::
n
integer,
intent(in)
::
n_i
integer,
intent(in)
::
n_groups_pad
integer,
intent(in)
::
n_j
public subroutine labelled_axpy(coeffs, g, label, a, b, c, n_label, n_f, n, n_i, n_groups_pad, n_j)
a, b, c += coeffs(1:3, l)*g at the points labelled l.
Arguments
Type
Intent
Optional
Attributes
Name
real(kind=dp),
intent(in)
::
coeffs(3,n_label)
real(kind=dp),
intent(in)
::
g(SZ,n_f,n_groups_pad*n_i)
real(kind=dp),
intent(in)
::
label(SZ,n_f,n_groups_pad*n_i)
real(kind=dp),
intent(inout)
::
a(SZ,n_f,n_groups_pad*n_i)
real(kind=dp),
intent(inout)
::
b(SZ,n_f,n_groups_pad*n_i)
real(kind=dp),
intent(inout)
::
c(SZ,n_f,n_groups_pad*n_i)
integer,
intent(in)
::
n_label
integer,
intent(in)
::
n_f
integer,
intent(in)
::
n
integer,
intent(in)
::
n_i
integer,
intent(in)
::
n_groups_pad
integer,
intent(in)
::
n_j
public subroutine field_max_sum(max_f, sum_f, f, n_f, n, n_i, n_groups_pad, n_j)
Maximum and sum of |f|.
Arguments
Type
Intent
Optional
Attributes
Name
real(kind=dp),
intent(out)
::
max_f
real(kind=dp),
intent(out)
::
sum_f
real(kind=dp),
intent(in)
::
f(SZ,n_f,n_groups_pad*n_i)
integer,
intent(in)
::
n_f
integer,
intent(in)
::
n
integer,
intent(in)
::
n_i
integer,
intent(in)
::
n_groups_pad
integer,
intent(in)
::
n_j
public subroutine slice_max_sum(max_f, sum_f, f, n_f, i_slice, n_i, n_groups_pad, n_j)
Signed maximum and sum of the slice f(:, i_slice, :).
Sets the x faces: a Dirichlet value c_start at the inlet (pencil index
1) and the convective outflow du/dt + Uc*du/dx = 0, Uc = c_end, at
the outlet (pencil index nx). BC_NEUMANN (1) leaves a face untouched.