base_backend_t Derived Type

type, public, abstract :: base_backend_t

base_backend class defines all the operations that the solver class requires.

For example, transport equation in solver class evaluates the derivatives in x, y, and z directions, and reorders the input fields as required. Then finally, combines all the directional derivatives to obtain the divergence of U*.

All these high level operations solver class executes are defined here. Every backend implementation extends the present backend class to define the specifics of these operations based on the target architecture.

None of the operations is deferred: each one defaults to not_implemented, which stops the run naming the operation. A backend therefore overrides only what it actually implements, and an operation added for one backend does not force a stub into every other backend. A backend reaching an operation it does not override fails loudly at the call site instead of silently doing nothing.

supports_device_field_export has a genuinely correct answer for a backend that does not override it (.false.), so it defaults to that rather than to an error.


Inherits

type~~base_backend_t~~InheritsGraph type~base_backend_t base_backend_t type~allocator_t allocator_t type~base_backend_t->type~allocator_t allocator type~mesh_t mesh_t type~base_backend_t->type~mesh_t mesh type~poisson_fft_t poisson_fft_t type~base_backend_t->type~poisson_fft_t poisson_fft type~field_t field_t type~allocator_t->type~field_t first type~geo_t geo_t type~mesh_t->type~geo_t geo type~grid_t grid_t type~mesh_t->type~grid_t grid type~par_t par_t type~mesh_t->type~par_t par type~poisson_fft_t->type~mesh_t mesh type~field_t->type~field_t next

Inherited by

type~~base_backend_t~~InheritedByGraph type~base_backend_t base_backend_t type~abl_diagnostics_t abl_diagnostics_t type~abl_diagnostics_t->type~base_backend_t backend type~abl_t abl_t type~abl_t->type~base_backend_t backend type~adm_t adm_t type~adm_t->type~base_backend_t backend type~backend_setup_t backend_setup_t type~backend_setup_t->type~base_backend_t backend type~cuda_backend_t cuda_backend_t type~backend_setup_t->type~cuda_backend_t cuda_backend type~omp_backend_t omp_backend_t type~backend_setup_t->type~omp_backend_t omp_backend type~omptgt_backend_t omptgt_backend_t type~backend_setup_t->type~omptgt_backend_t omptgt_backend type~cuda_backend_t->type~base_backend_t type~ibm_t ibm_t type~ibm_t->type~base_backend_t backend type~omp_backend_t->type~base_backend_t type~omptgt_backend_t->type~base_backend_t type~solver_t solver_t type~solver_t->type~base_backend_t backend type~solver_t->type~ibm_t ibm type~time_intg_t time_intg_t type~solver_t->type~time_intg_t time_integrator type~vector_calculus_t vector_calculus_t type~solver_t->type~vector_calculus_t vector_calculus type~time_intg_t->type~base_backend_t backend type~vector_calculus_t->type~base_backend_t backend type~base_case_t base_case_t type~base_case_t->type~solver_t solver type~case_abl_t case_abl_t type~case_abl_t->type~abl_diagnostics_t diagnostics type~case_abl_t->type~abl_t abl type~case_abl_t->type~base_case_t type~case_channel_t case_channel_t type~case_channel_t->type~base_case_t type~case_cylinder_t case_cylinder_t type~case_cylinder_t->type~base_case_t type~case_generic_t case_generic_t type~case_generic_t->type~base_case_t type~case_tgv_t case_tgv_t type~case_tgv_t->type~base_case_t type~case_wind_turbine_t case_wind_turbine_t type~case_wind_turbine_t->type~base_case_t

Components

Type Visibility Attributes Name Initial
integer, public :: n_halo = 4

DistD2 implementation is hardcoded for 4 halo layers for all backends

type(mesh_t), public, pointer :: mesh
class(allocator_t), public, pointer :: allocator
class(poisson_fft_t), public, pointer :: poisson_fft

Type-Bound Procedures

procedure, public :: transeq_x => transeq_x_base

  • public subroutine transeq_x_base(self, du, dv, dw, u, v, w, nu, dirps)

    transeq equation obtains the derivatives direction by direction, and the exact algorithm used to obtain these derivatives are decided at runtime. Backend implementations are responsible from directing calls to transeq_x into the correct algorithm.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: du
    class(field_t), intent(inout) :: dv
    class(field_t), intent(inout) :: dw
    class(field_t), intent(in) :: u
    class(field_t), intent(in) :: v
    class(field_t), intent(in) :: w
    real(kind=dp), intent(in) :: nu
    type(dirps_t), intent(in) :: dirps

procedure, public :: transeq_y => transeq_y_base

  • public subroutine transeq_y_base(self, du, dv, dw, u, v, w, nu, dirps)

    As transeq_x, for the y direction.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: du
    class(field_t), intent(inout) :: dv
    class(field_t), intent(inout) :: dw
    class(field_t), intent(in) :: u
    class(field_t), intent(in) :: v
    class(field_t), intent(in) :: w
    real(kind=dp), intent(in) :: nu
    type(dirps_t), intent(in) :: dirps

procedure, public :: transeq_z => transeq_z_base

  • public subroutine transeq_z_base(self, du, dv, dw, u, v, w, nu, dirps)

    As transeq_x, for the z direction.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: du
    class(field_t), intent(inout) :: dv
    class(field_t), intent(inout) :: dw
    class(field_t), intent(in) :: u
    class(field_t), intent(in) :: v
    class(field_t), intent(in) :: w
    real(kind=dp), intent(in) :: nu
    type(dirps_t), intent(in) :: dirps

procedure, public :: transeq_species => transeq_species_base

  • public subroutine transeq_species_base(self, dspec, uvw, spec, nu, dirps, sync)

    As transeq_x, for a scalar species transported by uvw.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: dspec
    class(field_t), intent(in) :: uvw
    class(field_t), intent(in) :: spec
    real(kind=dp), intent(in) :: nu
    type(dirps_t), intent(in) :: dirps
    logical, intent(in) :: sync

procedure, public :: tds_solve => tds_solve_base

  • public subroutine tds_solve_base(self, du, u, tdsops)

    Applies a tridiagonal operator to u, the exact algorithm used being decided at runtime. Backend implementations are responsible from directing calls to tds_solve to the correct algorithm.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: du
    class(field_t), intent(in) :: u
    class(tdsops_t), intent(in) :: tdsops

procedure, public :: thom_solve => thom_solve_base

  • public subroutine thom_solve_base(self, du, u, tdsops)

    As tds_solve, solving the tridiagonal system with the Thomas algorithm.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: du
    class(field_t), intent(in) :: u
    class(tdsops_t), intent(in) :: tdsops

procedure, public :: reorder => reorder_base

  • public subroutine reorder_base(self, u_, u, direction)

    reorder subroutines are straightforward, they rearrange data into our specialist data structure so that regardless of the direction tridiagonal systems are solved efficiently and fast.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: u_
    class(field_t), intent(in) :: u
    integer, intent(in) :: direction

procedure, public :: sum_yintox => sum_yintox_base

  • public subroutine sum_yintox_base(self, u, u_)

    sum_yintox combines a y directional field into the corresponding x directional field.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: u
    class(field_t), intent(in) :: u_

procedure, public :: sum_zintox => sum_zintox_base

  • public subroutine sum_zintox_base(self, u, u_)

    As sum_yintox, for a z directional field.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: u
    class(field_t), intent(in) :: u_

procedure, public :: veccopy => veccopy_base

  • public subroutine veccopy_base(self, dst, src)

    copy vectors: y = x

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: dst
    class(field_t), intent(in) :: src

procedure, public :: vecadd => vecadd_base

  • public subroutine vecadd_base(self, a, x, b, y)

    adds two vectors together: y = ax + by

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    real(kind=dp), intent(in) :: a
    class(field_t), intent(in) :: x
    real(kind=dp), intent(in) :: b
    class(field_t), intent(inout) :: y

procedure, public :: vecmult => vecmult_base

  • public subroutine vecmult_base(self, y, x)

    pointwise multiplication between two vectors: y(:) = y(:) * x(:)

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: y
    class(field_t), intent(in) :: x

procedure, public :: scalar_product => scalar_product_base

  • public function scalar_product_base(self, x, y) result(s)

    Calculates the scalar product of two input fields

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(in) :: x
    class(field_t), intent(in) :: y

    Return Value real(kind=dp)

procedure, public :: vector_norm_squared => vector_norm_squared_base

  • public function vector_norm_squared_base(self, a, b, c) result(norm_squared)

    Computes the global discrete squared norm of a three-component field.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(in) :: a
    class(field_t), intent(in) :: b
    class(field_t), intent(in) :: c

    Return Value real(kind=dp)

procedure, public :: field_labelled_sums => field_labelled_sums_base

  • public subroutine field_labelled_sums_base(self, sums, g, label, a, b, c)

    Computes this rank's sums of ga, gb and g*c separately for each label in a single pass over DIR_X fields. label holds integer values stored as reals; points labelled l in 1..size(sums, 2) add to sums(:, l) and all other points are skipped. No MPI reduction is done, so the caller can reduce all labels together in one MPI call.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    real(kind=dp), intent(out) :: sums(:,:)
    class(field_t), intent(in) :: g
    class(field_t), intent(in) :: label
    class(field_t), intent(in) :: a
    class(field_t), intent(in) :: b
    class(field_t), intent(in) :: c

procedure, public :: field_labelled_axpy => field_labelled_axpy_base

  • public subroutine field_labelled_axpy_base(self, coeffs, g, label, a, b, c)

    Adds coeffs(1, l)g, coeffs(2, l)g and coeffs(3, l)*g to a, b and c at every point of the DIR_X fields labelled l in 1..size(coeffs, 2). Points with any other label are left unchanged.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    real(kind=dp), intent(in) :: coeffs(:,:)
    class(field_t), intent(in) :: g
    class(field_t), intent(in) :: label
    class(field_t), intent(inout) :: a
    class(field_t), intent(inout) :: b
    class(field_t), intent(inout) :: c

procedure, public :: field_max_mean => field_max_mean_base

  • public subroutine field_max_mean_base(self, max_val, mean_val, f, enforced_data_loc)

    Obtains maximum and mean values in a field

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    real(kind=dp), intent(out) :: max_val
    real(kind=dp), intent(out) :: mean_val
    class(field_t), intent(in) :: f
    integer, intent(in), optional :: enforced_data_loc

procedure, public :: slice_max_sum => slice_max_sum_base

  • public subroutine slice_max_sum_base(self, max_val, sum_val, f, i_slice, enforced_data_loc)

    Reduces a single slice of f at index i_slice along f's DIR axis. Returns signed max (not abs) and signed sum. No division by count. Caller is responsible for MPI_Allreduce across ranks.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    real(kind=dp), intent(out) :: max_val
    real(kind=dp), intent(out) :: sum_val
    class(field_t), intent(in) :: f
    integer, intent(in) :: i_slice
    integer, intent(in), optional :: enforced_data_loc

procedure, public :: field_plane_sums => field_plane_sums_base

  • public subroutine field_plane_sums_base(self, sums, f)

    Sum a DIR_X field over x and z on every local y-plane: sums(j) is the sum over the plane of y index j. The order of summation is fixed, so the result is reproducible.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    real(kind=dp), intent(out) :: sums(:)
    class(field_t), intent(in) :: f

procedure, public :: field_scale => field_scale_base

  • public subroutine field_scale_base(self, f, a)

    Scales a field by a

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(in) :: f
    real(kind=dp), intent(in) :: a

procedure, public :: field_shift => field_shift_base

  • public subroutine field_shift_base(self, f, a)

    Shifts a field by a

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(in) :: f
    real(kind=dp), intent(in) :: a

procedure, public :: field_volume_integral => field_volume_integral_base

  • public function field_volume_integral_base(self, f) result(s)

    Reduces field to a scalar by integrating over the volume

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(in) :: f

    Return Value real(kind=dp)

procedure, public :: field_set_face => field_set_face_base

  • public subroutine field_set_face_base(self, f, c_start, c_end, face, bc_start, bc_end, flow_rate_diff)

    A field is a subdomain with a rectangular cuboid shape. It has 6 faces, and these faces are either a subdomain boundary or a global domain boundary based on the location of the subdomain. This subroutine allows us to set any of these faces to a value, 'c_start' and 'c_end' for faces at opposite sides. 'face' is one of X_FACE, Y_FACE, Z_FACE from common.f90 Optionally, bc_start/bc_end select the BC type (default BC_DIRICHLET).

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: f
    real(kind=dp), intent(in) :: c_start
    real(kind=dp), intent(in) :: c_end
    integer, intent(in) :: face
    integer, intent(in), optional :: bc_start
    integer, intent(in), optional :: bc_end
    real(kind=dp), intent(in), optional :: flow_rate_diff

procedure, public :: field_set_y_plane => field_set_y_plane_base

  • public subroutine field_set_y_plane_base(self, f, c, plane)

    Set one interior y-plane of a DIR_X field to a constant.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: f
    real(kind=dp), intent(in) :: c
    integer, intent(in) :: plane

    1-based y-vertex index

procedure, public :: field_set_abl_wall_stress => field_set_abl_wall_stress_base

  • public subroutine field_set_abl_wall_stress_base(self, stress, u, w, sample_plane, stress_plane, drag_coeff, component)

    Replace one SGS stress plane using the local sampled velocity.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: stress
    class(field_t), intent(in) :: u
    class(field_t), intent(in) :: w
    integer, intent(in) :: sample_plane
    integer, intent(in) :: stress_plane
    real(kind=dp), intent(in) :: drag_coeff
    integer, intent(in) :: component

procedure, public :: field_set_face_from_field => field_set_face_from_field_base

  • public subroutine field_set_face_from_field_base(self, f, f_start, c_end, face, bc_start, bc_end, flow_rate_diff)

    As field_set_face but with a spatially-varying inlet face field instead of a scalar c_start.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: f
    class(field_t), intent(in) :: f_start
    real(kind=dp), intent(in) :: c_end
    integer, intent(in) :: face
    integer, intent(in), optional :: bc_start
    integer, intent(in), optional :: bc_end
    real(kind=dp), intent(in), optional :: flow_rate_diff

procedure, public :: field_add_face_from_field => field_add_face_from_field_base

  • public subroutine field_add_face_from_field_base(self, f, g, face, bc_start, bc_end)

    Add the face planes of g onto those of f, on Dirichlet faces only. Both fields are DIR_X; X_FACE and Y_FACE are supported.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: f
    class(field_t), intent(in) :: g
    integer, intent(in) :: face
    integer, intent(in) :: bc_start
    integer, intent(in) :: bc_end

procedure, public :: field_add_const_x_face => field_add_const_x_face_base

  • public subroutine field_add_const_x_face_base(self, f, c, at_end)

    Adds a uniform constant c to one x-normal face plane of a DIR_X field, in place. Used to enforce exact outlet mass conservation: after the convective outflow update, the outlet-plane mean is shifted uniformly so that it matches the prescribed inlet mean (mirrors Incompact3d's bxxn = bxxn - ut + ut1). at_end = .true. -> the x = nx plane (outlet) at_end = .false. -> the x = 1 plane (inlet)

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: f
    real(kind=dp), intent(in) :: c
    logical, intent(in) :: at_end

procedure, public :: field_set_x_inlet_plane => field_set_x_inlet_plane_base

  • public subroutine field_set_x_inlet_plane_base(self, f, plane)

    Overwrites the x = 1 plane (pencil index 1) of a DIR_X field with the host array plane(ny, nz), in local VERT dims. Only the plane crosses to the device, so a time-varying inlet can be refreshed without uploading and reordering a full 3D field.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: f
    real(kind=dp), intent(in), dimension(:, :) :: plane

procedure, public :: compute_vorticity => compute_vorticity_base

  • public subroutine compute_vorticity_base(self, field_out, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

    Computes the vorticity magnitude from velocity gradients

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: field_out
    class(field_t), intent(in) :: dudx
    class(field_t), intent(in) :: dudy
    class(field_t), intent(in) :: dudz
    class(field_t), intent(in) :: dvdx
    class(field_t), intent(in) :: dvdy
    class(field_t), intent(in) :: dvdz
    class(field_t), intent(in) :: dwdx
    class(field_t), intent(in) :: dwdy
    class(field_t), intent(in) :: dwdz

procedure, public :: compute_qcriterion => compute_qcriterion_base

  • public subroutine compute_qcriterion_base(self, field_out, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

    Computes the Q-criterion from velocity gradients

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: field_out
    class(field_t), intent(in) :: dudx
    class(field_t), intent(in) :: dudy
    class(field_t), intent(in) :: dudz
    class(field_t), intent(in) :: dvdx
    class(field_t), intent(in) :: dvdy
    class(field_t), intent(in) :: dvdz
    class(field_t), intent(in) :: dwdx
    class(field_t), intent(in) :: dwdy
    class(field_t), intent(in) :: dwdz

procedure, public :: compute_smagorinsky_nut => compute_smagorinsky_nut_base

  • public subroutine compute_smagorinsky_nut_base(self, nut, mixing_length_sq, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

    Computes nut=l_s^2sqrt(2S_ij*S_ij) from velocity gradients.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: nut
    class(field_t), intent(in) :: mixing_length_sq
    class(field_t), intent(in) :: dudx
    class(field_t), intent(in) :: dudy
    class(field_t), intent(in) :: dudz
    class(field_t), intent(in) :: dvdx
    class(field_t), intent(in) :: dvdy
    class(field_t), intent(in) :: dvdz
    class(field_t), intent(in) :: dwdx
    class(field_t), intent(in) :: dwdy
    class(field_t), intent(in) :: dwdz

procedure, public :: compute_sgs_stress => compute_sgs_stress_base

  • public subroutine compute_sgs_stress_base(self, stress, nut, gradient_a, gradient_b, scale_a, scale_b)

    Forms nut(scale_agradient_a + scale_b*gradient_b).

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: stress
    class(field_t), intent(in) :: nut
    class(field_t), intent(in) :: gradient_a
    class(field_t), intent(in) :: gradient_b
    real(kind=dp), intent(in) :: scale_a
    real(kind=dp), intent(in) :: scale_b

procedure, public :: copy_data_to_f => copy_data_to_f_base

  • public subroutine copy_data_to_f_base(self, f, data)

    Copy a regular 3D array in host memory into the specialist data structure field that lives on device or host

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t), intent(inout) :: self
    class(field_t), intent(inout) :: f
    real(kind=dp), intent(in), dimension(:, :, :) :: data

procedure, public :: copy_f_to_data => copy_f_to_data_base

  • public subroutine copy_f_to_data_base(self, data, f)

    Copy the specialist data structure from device or host back to a regular 3D data array in host memory.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t), intent(inout) :: self
    real(kind=dp), intent(out), dimension(:, :, :) :: data
    class(field_t), intent(in) :: f

procedure, public :: alloc_tdsops => alloc_tdsops_base

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

    Allocates the backend's own tdsops type and fills in the coefficients of the requested operation.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(tdsops_t), intent(inout), allocatable :: 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

procedure, public :: init_poisson_fft => init_poisson_fft_base

  • public subroutine init_poisson_fft_base(self, mesh, xdirps, ydirps, zdirps, lowmem)

    Allocates and initialises the backend's FFT based Poisson solver.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    type(mesh_t), intent(in), target :: mesh
    type(dirps_t), intent(in) :: xdirps
    type(dirps_t), intent(in) :: ydirps
    type(dirps_t), intent(in) :: zdirps
    logical, intent(in), optional :: lowmem

procedure, public :: sync => sync_base

  • public subroutine sync_base(self)

    Waits for outstanding device work.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self

procedure, public :: get_device_bw_info => get_device_bw_info_base

  • public subroutine get_device_bw_info_base(self, mem_clock_rt, mem_bus_width, available)

    Reports the memory clock rate and bus width of the target device, used to work out a theoretical peak bandwidth.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    integer, intent(out) :: mem_clock_rt
    integer, intent(out) :: mem_bus_width
    logical, intent(out) :: available

procedure, public :: base_init

procedure, public :: get_field_data

  • public subroutine get_field_data(self, data, f, dir)

    Extract data from field f optionally reordering into dir orientation. To output in same orientation as f, use call ...%get_field_data(data, f, f%dir)

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    real(kind=dp), intent(out), dimension(:, :, :) :: data

    Output array

    class(field_t), intent(in) :: f

    Field

    integer, intent(in), optional :: dir

    Desired orientation of output array (defaults to Cartesian)

procedure, public :: set_field_data

  • public subroutine set_field_data(self, f, data, dir)

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    class(field_t), intent(inout) :: f

    Field

    real(kind=dp), intent(in), dimension(:, :, :) :: data

    Input array

    integer, intent(in), optional :: dir

    Orientation of input array (defaults to Cartesian)

procedure, public :: supports_device_field_export

  • public function supports_device_field_export(self, f)

    Whether export_field_to_device can pack field f without staging it through host memory. Backends without device memory keep this default and report no support.

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t), intent(in) :: self
    class(field_t), intent(in) :: f

    Return Value logical

procedure, public :: export_field_to_device

  • public subroutine export_field_to_device(self, buffer, f, dims, to_sp)

    Pack the first dims Cartesian points of field f into a contiguous device buffer, in (i, j, k) order without padding.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t) :: self
    type(c_ptr), intent(in) :: buffer
    class(field_t), intent(in) :: f
    integer, intent(in) :: dims(3)
    logical, intent(in) :: to_sp