m_omptgt_kernels_dist Module

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).


Uses

  • module~~m_omptgt_kernels_dist~~UsesGraph module~m_omptgt_kernels_dist m_omptgt_kernels_dist module~m_common m_common module~m_omptgt_kernels_dist->module~m_common module~m_omptgt_common m_omptgt_common module~m_omptgt_kernels_dist->module~m_omptgt_common m_mpi m_mpi module~m_common->m_mpi module~m_logger m_logger module~m_common->module~m_logger module~m_omptgt_common->module~m_common iso_c_binding iso_c_binding module~m_omptgt_common->iso_c_binding module~m_omptgt_common->module~m_logger omp_lib omp_lib module~m_omptgt_common->omp_lib module~m_logger->m_mpi iso_fortran_env iso_fortran_env module~m_logger->iso_fortran_env

Used by

  • module~~m_omptgt_kernels_dist~~UsedByGraph module~m_omptgt_kernels_dist m_omptgt_kernels_dist module~m_omptgt_exec_dist m_omptgt_exec_dist module~m_omptgt_exec_dist->module~m_omptgt_kernels_dist module~m_omptgt_backend m_omptgt_backend module~m_omptgt_backend->module~m_omptgt_exec_dist module~m_backend_setup m_backend_setup module~m_backend_setup->module~m_omptgt_backend program~x3d2_poisson_solver x3d2_poisson_solver program~x3d2_poisson_solver->module~m_backend_setup program~xcompact xcompact program~xcompact->module~m_backend_setup

Subroutines

public subroutine der_univ_dist(du, send_u_s, send_u_e, u, u_s, u_e, n_tds, n_rhs, coeffs_s, coeffs_e, coeffs, ffr, fbc, faf, n, n_groups)

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.

Arguments

Type IntentOptional 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

public subroutine der_univ_subs(du, recv_u_s, recv_u_e, n_tds, dist_sa, dist_sc, strch, n, n_groups)

Second phase of the distributed solve: resolves the 2x2 boundary systems with the neighbours' values and substitutes back.

Arguments

Type IntentOptional 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

public subroutine transeq_3fused_dist(du, dud, d2u, send_du_s, send_du_e, send_dud_s, send_dud_e, send_d2u_s, send_d2u_e, u, u_s, u_e, v, v_s, v_e, n_tds, n_rhs, du_coeffs_s, du_coeffs_e, du_coeffs, du_fw, du_bw, du_af, dud_coeffs_s, dud_coeffs_e, dud_coeffs, dud_fw, dud_bw, dud_af, d2u_coeffs_s, d2u_coeffs_e, d2u_coeffs, d2u_fw, d2u_bw, d2u_af, n, n_groups)

First phase for du = d(u), dud = d(u*v) and d2u = d2(u) in one sweep.

Arguments

Type IntentOptional 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

public subroutine transeq_3fused_subs(r_du, conv, dud, d2u, recv_du_s, recv_du_e, recv_dud_s, recv_dud_e, recv_d2u_s, recv_d2u_e, n_tds, nu, du_sa, du_sc, du_strch, dud_sa, dud_sc, dud_strch, d2u_sa, d2u_sc, d2u_strch, d2u_strch_cor, n, n_groups)

Second phase: substitutes back and combines r_du = -1/2(convdu + dud) + nu*d2u.

Arguments

Type IntentOptional 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

public subroutine der_penta_full(du, u, u_s, u_e, n_tds, n_rhs, coeffs_s, coeffs_e, coeffs, ffr, faf, fsa, fbw, beta_lhs, beta_lhs_s, n, n_groups)

Full non-periodic pentadiagonal solve on a single subdomain.

Arguments

Type IntentOptional 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

public subroutine der_penta_periodic(du, u, u_s, u_e, n_tds, n_rhs, coeffs_s, coeffs_e, coeffs, ffr, faf, fsa, fbw, beta_lhs, beta_lhs_s, alp, bet, z, n, 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.

Arguments

Type IntentOptional 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