Distributed compact-scheme kernels for the OpenMP target backend, following cuda/kernels/distributed.f90.
A CUDA kernel there runs one thread per pencil line, (i, b) = (threadIdx,
blockIdx), each sweeping its line serially. Here every kernel offloads
the same (b, i) iteration space with teams distribute parallel do and
hands each line to a declare target routine ending in _line. Keeping
the sweep in its own routine makes all of its temporaries per-line locals
with no private clause to keep in step, and the explicit distribute
parallel do keeps NVHPC from serialising each team, as it does when
teams loop meets a procedure call.
Arrays are explicit-shape or assumed-size dummies named in
OMP_DEVICE_ADDR (see m_omptgt_common). Fields are (SZ, n, n_groups),
halo buffers (SZ, 4, n_groups) and the 2x2-system buffers
(SZ, 1, n_groups). The boundary stencils are 9 wide (n_halo = 4).
First phase of the distributed solve: builds the RHS and runs the forward and backward hybrid sweeps, leaving the 2x2 boundary values in the send buffers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(inout) | :: | du(SZ,n,n_groups) | |||
| real(kind=dp), | intent(inout) | :: | send_u_s(SZ,1,n_groups) | |||
| real(kind=dp), | intent(inout) | :: | send_u_e(SZ,1,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u_s(SZ,4,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u_e(SZ,4,n_groups) | |||
| integer, | intent(in) | :: | n_tds | |||
| integer, | intent(in) | :: | n_rhs | |||
| real(kind=dp), | intent(in) | :: | coeffs_s(9,4) | |||
| real(kind=dp), | intent(in) | :: | coeffs_e(9,4) | |||
| real(kind=dp), | intent(in) | :: | coeffs(9) | |||
| real(kind=dp), | intent(in) | :: | ffr(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | fbc(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | faf(n_rhs) | |||
| integer, | intent(in) | :: | n | |||
| integer, | intent(in) | :: | n_groups |
Second phase of the distributed solve: resolves the 2x2 boundary systems with the neighbours' values and substitutes back.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(inout) | :: | du(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | recv_u_s(SZ,1,n_groups) | |||
| real(kind=dp), | intent(in) | :: | recv_u_e(SZ,1,n_groups) | |||
| integer, | intent(in) | :: | n_tds | |||
| real(kind=dp), | intent(in) | :: | dist_sa(n_tds) | |||
| real(kind=dp), | intent(in) | :: | dist_sc(n_tds) | |||
| real(kind=dp), | intent(in) | :: | strch(n_tds) | |||
| integer, | intent(in) | :: | n | |||
| integer, | intent(in) | :: | n_groups |
First phase for du = d(u), dud = d(u*v) and d2u = d2(u) in one sweep.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(inout) | :: | du(SZ,n,n_groups) | |||
| real(kind=dp), | intent(inout) | :: | dud(SZ,n,n_groups) | |||
| real(kind=dp), | intent(inout) | :: | d2u(SZ,n,n_groups) | |||
| real(kind=dp), | intent(inout) | :: | send_du_s(SZ,1,n_groups) | |||
| real(kind=dp), | intent(inout) | :: | send_du_e(SZ,1,n_groups) | |||
| real(kind=dp), | intent(inout) | :: | send_dud_s(SZ,1,*) | |||
| real(kind=dp), | intent(inout) | :: | send_dud_e(SZ,1,*) | |||
| real(kind=dp), | intent(inout) | :: | send_d2u_s(SZ,1,*) | |||
| real(kind=dp), | intent(inout) | :: | send_d2u_e(SZ,1,*) | |||
| real(kind=dp), | intent(in) | :: | u(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u_s(SZ,4,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u_e(SZ,4,n_groups) | |||
| real(kind=dp), | intent(in) | :: | v(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | v_s(SZ,4,n_groups) | |||
| real(kind=dp), | intent(in) | :: | v_e(SZ,4,n_groups) | |||
| integer, | intent(in) | :: | n_tds | |||
| integer, | intent(in) | :: | n_rhs | |||
| real(kind=dp), | intent(in) | :: | du_coeffs_s(9,4) | |||
| real(kind=dp), | intent(in) | :: | du_coeffs_e(9,4) | |||
| real(kind=dp), | intent(in) | :: | du_coeffs(9) | |||
| real(kind=dp), | intent(in) | :: | du_fw(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | du_bw(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | du_af(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | dud_coeffs_s(9,4) | |||
| real(kind=dp), | intent(in) | :: | dud_coeffs_e(9,4) | |||
| real(kind=dp), | intent(in) | :: | dud_coeffs(9) | |||
| real(kind=dp), | intent(in) | :: | dud_fw(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | dud_bw(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | dud_af(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | d2u_coeffs_s(9,4) | |||
| real(kind=dp), | intent(in) | :: | d2u_coeffs_e(9,4) | |||
| real(kind=dp), | intent(in) | :: | d2u_coeffs(9) | |||
| real(kind=dp), | intent(in) | :: | d2u_fw(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | d2u_bw(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | d2u_af(n_rhs) | |||
| integer, | intent(in) | :: | n | |||
| integer, | intent(in) | :: | n_groups |
Second phase: substitutes back and combines r_du = -1/2(convdu + dud) + nu*d2u.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(inout) | :: | r_du(SZ,n,n_groups) |
Holds du on entry and the result on exit |
||
| real(kind=dp), | intent(in) | :: | conv(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | dud(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | d2u(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | recv_du_s(SZ,1,n_groups) | |||
| real(kind=dp), | intent(in) | :: | recv_du_e(SZ,1,n_groups) | |||
| real(kind=dp), | intent(in) | :: | recv_dud_s(SZ,1,*) | |||
| real(kind=dp), | intent(in) | :: | recv_dud_e(SZ,1,*) | |||
| real(kind=dp), | intent(in) | :: | recv_d2u_s(SZ,1,*) | |||
| real(kind=dp), | intent(in) | :: | recv_d2u_e(SZ,1,*) | |||
| integer, | intent(in) | :: | n_tds | |||
| real(kind=dp), | intent(in) | :: | nu | |||
| real(kind=dp), | intent(in) | :: | du_sa(n_tds) | |||
| real(kind=dp), | intent(in) | :: | du_sc(n_tds) | |||
| real(kind=dp), | intent(in) | :: | du_strch(n_tds) | |||
| real(kind=dp), | intent(in) | :: | dud_sa(n_tds) | |||
| real(kind=dp), | intent(in) | :: | dud_sc(n_tds) | |||
| real(kind=dp), | intent(in) | :: | dud_strch(n_tds) | |||
| real(kind=dp), | intent(in) | :: | d2u_sa(n_tds) | |||
| real(kind=dp), | intent(in) | :: | d2u_sc(n_tds) | |||
| real(kind=dp), | intent(in) | :: | d2u_strch(n_tds) | |||
| real(kind=dp), | intent(in) | :: | d2u_strch_cor(n_tds) | |||
| integer, | intent(in) | :: | n | |||
| integer, | intent(in) | :: | n_groups |
Full non-periodic pentadiagonal solve on a single subdomain.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(inout) | :: | du(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u_s(SZ,4,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u_e(SZ,4,n_groups) | |||
| integer, | intent(in) | :: | n_tds | |||
| integer, | intent(in) | :: | n_rhs | |||
| real(kind=dp), | intent(in) | :: | coeffs_s(9,4) | |||
| real(kind=dp), | intent(in) | :: | coeffs_e(9,4) | |||
| real(kind=dp), | intent(in) | :: | coeffs(9) | |||
| real(kind=dp), | intent(in) | :: | ffr(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | faf(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | fsa(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | fbw(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | beta_lhs | |||
| real(kind=dp), | intent(in) | :: | beta_lhs_s | |||
| integer, | intent(in) | :: | n | |||
| integer, | intent(in) | :: | n_groups |
Cyclic pentadiagonal solve via Sherman-Morrison-Woodbury (rank 4):
A_cyc = A_np + UC with U = [e_1|e_2|e_{n-1}|e_n]. z holds
A_np^{-1}U (see omptgt_tdsops_t%penta_z_dev); each line forms
M = I + CZ, solves Mc = Cy and applies y -= Zc.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(inout) | :: | du(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u(SZ,n,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u_s(SZ,4,n_groups) | |||
| real(kind=dp), | intent(in) | :: | u_e(SZ,4,n_groups) | |||
| integer, | intent(in) | :: | n_tds | |||
| integer, | intent(in) | :: | n_rhs | |||
| real(kind=dp), | intent(in) | :: | coeffs_s(9,4) | |||
| real(kind=dp), | intent(in) | :: | coeffs_e(9,4) | |||
| real(kind=dp), | intent(in) | :: | coeffs(9) | |||
| real(kind=dp), | intent(in) | :: | ffr(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | faf(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | fsa(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | fbw(n_rhs) | |||
| real(kind=dp), | intent(in) | :: | beta_lhs | |||
| real(kind=dp), | intent(in) | :: | beta_lhs_s | |||
| real(kind=dp), | intent(in) | :: | alp | |||
| real(kind=dp), | intent(in) | :: | bet | |||
| real(kind=dp), | intent(in) | :: | z(n_tds,4) | |||
| integer, | intent(in) | :: | n | |||
| integer, | intent(in) | :: | n_groups |