m_omptgt_tdsops Module

OpenMP target extension of the tridiagonal solver operators.

The host tdsops_t is built as usual and its coefficient arrays are copied once into device arrays, as cuda_tdsops_t does, so the kernels read them in place instead of mapping them on every launch.

The device arrays are not freed: there is no finaliser, because the intrinsic assignment of a structure constructor would finalise the temporary and release storage the copy still points at. Operators are built once at start-up and live for the whole run, so construct them in place with omptgt_tdsops_init rather than by assignment.


Uses

  • module~~m_omptgt_tdsops~~UsesGraph module~m_omptgt_tdsops m_omptgt_tdsops module~m_common m_common module~m_omptgt_tdsops->module~m_common module~m_omptgt_common m_omptgt_common module~m_omptgt_tdsops->module~m_omptgt_common module~m_tdsops m_tdsops module~m_omptgt_tdsops->module~m_tdsops 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_tdsops->module~m_common module~m_tdsops->module~m_logger module~m_logger->m_mpi iso_fortran_env iso_fortran_env module~m_logger->iso_fortran_env

Used by

  • module~~m_omptgt_tdsops~~UsedByGraph module~m_omptgt_tdsops m_omptgt_tdsops module~m_omptgt_backend m_omptgt_backend module~m_omptgt_backend->module~m_omptgt_tdsops module~m_omptgt_exec_dist m_omptgt_exec_dist module~m_omptgt_backend->module~m_omptgt_exec_dist module~m_omptgt_exec_thom m_omptgt_exec_thom module~m_omptgt_backend->module~m_omptgt_exec_thom module~m_omptgt_exec_dist->module~m_omptgt_tdsops module~m_omptgt_exec_thom->module~m_omptgt_tdsops 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

Derived Types

type, public, extends(tdsops_t) ::  omptgt_tdsops_t

Components

Type Visibility Attributes Name Initial
real(kind=dp), public, allocatable, dimension(:) :: dist_fw

fw/bw phase back subs. the auxiliary factors

real(kind=dp), public, allocatable, dimension(:) :: dist_bw

fw/bw phase back subs. the auxiliary factors

real(kind=dp), public, allocatable, dimension(:) :: dist_sa

fw/bw phase back subs. the auxiliary factors

real(kind=dp), public, allocatable, dimension(:) :: dist_sc

fw/bw phase back subs. the auxiliary factors

real(kind=dp), public, allocatable, dimension(:) :: dist_af

fw/bw phase back subs. the auxiliary factors

real(kind=dp), public, allocatable, dimension(:) :: thom_f
real(kind=dp), public, allocatable, dimension(:) :: thom_s
real(kind=dp), public, allocatable, dimension(:) :: thom_w
real(kind=dp), public, allocatable, dimension(:) :: thom_p
real(kind=dp), public, allocatable :: stretch(:)
real(kind=dp), public, allocatable :: stretch_correct(:)
real(kind=dp), public, allocatable :: coeffs(:)
real(kind=dp), public, allocatable :: coeffs_s(:,:)
real(kind=dp), public, allocatable :: coeffs_e(:,:)
real(kind=dp), public :: alpha

Compact scheme coeffs

real(kind=dp), public :: a

Compact scheme coeffs

real(kind=dp), public :: b

Compact scheme coeffs

real(kind=dp), public :: c = 0._dp

Compact scheme coeffs

real(kind=dp), public :: d = 0._dp

Compact scheme coeffs

real(kind=dp), public :: beta = 0._dp

LHS 2nd off-diagonal (pentadiag LHS only)

real(kind=dp), public :: beta_lhs_s = 0._dp

j=1 backward-sub beta (0/2β Neumann, β otherwise)

logical, public :: periodic
logical, public :: pentadiag = .false.

.true. for pentadiagonal LHS schemes Solve with the serial Thomas algorithm instead of the distributed one. The distributed solver truncates a neighbour's influence at the subdomain edge, which is invisible for the well-conditioned derivative operators but not for the low-pass filter, whose system is only marginally diagonally dominant as alpha approaches 0.5. Thomas is serial along the line, so this is only valid when the direction is not decomposed.

logical, public :: prefer_thomas = .false.
integer, public :: n_tds

Tridiagonal system size

integer, public :: n_rhs

Right-hand-side builder size

integer, public :: move = 0

move between vertices and cell centres

integer, public :: n_halo

number of halo points

real(kind=dp), public, pointer, contiguous :: dist_fw_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: dist_bw_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: dist_sa_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: dist_sc_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: dist_af_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: thom_f_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: thom_s_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: thom_w_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: thom_p_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: stretch_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: stretch_correct_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: coeffs_dev(:) => null()
real(kind=dp), public, pointer, contiguous :: coeffs_s_dev(:,:) => null()
real(kind=dp), public, pointer, contiguous :: coeffs_e_dev(:,:) => null()
real(kind=dp), public, pointer, contiguous :: penta_z_dev(:,:) => null()

Columns of A_np^{-1}*[e_1|e_2|e_{n-1}|e_n] for the cyclic pentadiagonal solve. They depend on the operator alone, so they are built once here where the CUDA kernel rebuilds them in every block.

Type-Bound Procedures

procedure, public :: lowpass
procedure, public :: stagder_1st
procedure, public :: interpl_mid
procedure, public :: deriv_2nd
procedure, public :: deriv_1st
procedure, public :: preprocess_thom
procedure, public :: preprocess_penta_dist
procedure, public :: preprocess_dist

Functions

public function penta_periodic_columns(tdsops) result(z)

Solves A_np*z_k = e_{p_k} for p = 1, 2, n-1, n with the non-periodic pentadiagonal LU factors, as thread 1 of der_penta_periodic does in the CUDA backend.

Arguments

Type IntentOptional Attributes Name
class(tdsops_t), intent(in) :: tdsops

Return Value real(kind=dp), (tdsops%n_tds,4)


Subroutines

public subroutine omptgt_tdsops_init(tdsops, n_tds, delta, operation, scheme, bc_start, bc_end, stretch, stretch_correct, n_halo, from_to, sym, c_nu, nu0_nu, filter_alpha)

Initialises tdsops in place. See tdsops_t for the arguments.

Arguments

Type IntentOptional Attributes Name
type(omptgt_tdsops_t), intent(inout) :: tdsops
integer, intent(in) :: n_tds
real(kind=dp), intent(in) :: delta
character(len=*), intent(in) :: operation
character(len=*), intent(in) :: scheme
integer, intent(in) :: bc_start
integer, intent(in) :: bc_end
real(kind=dp), intent(in), optional :: stretch(:)
real(kind=dp), intent(in), optional :: stretch_correct(:)
integer, intent(in), optional :: n_halo
character(len=*), intent(in), optional :: from_to
logical, intent(in), optional :: sym
real(kind=dp), intent(in), optional :: c_nu
real(kind=dp), intent(in), optional :: nu0_nu
real(kind=dp), intent(in), optional :: filter_alpha