cuda_backend_t Derived Type

type, public, extends(base_backend_t) :: cuda_backend_t


Inherits

type~~cuda_backend_t~~InheritsGraph type~cuda_backend_t cuda_backend_t dim3 dim3 type~cuda_backend_t->dim3 xblocks, xthreads, yblocks, ythreads, zblocks, zthreads type~base_backend_t base_backend_t type~cuda_backend_t->type~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~field_t->type~field_t next

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
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: u_recv_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: u_recv_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: u_send_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: u_send_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: v_recv_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: v_recv_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: v_send_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: v_send_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: w_recv_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: w_recv_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: w_send_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: w_send_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: du_send_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: du_send_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: du_recv_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: du_recv_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: dud_send_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: dud_send_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: dud_recv_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: dud_recv_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: d2u_send_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: d2u_send_e_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: d2u_recv_s_dev
real(kind=dp), public, device, allocatable, dimension(:, :, :) :: d2u_recv_e_dev
type(dim3), public :: xblocks
type(dim3), public :: xthreads
type(dim3), public :: yblocks
type(dim3), public :: ythreads
type(dim3), public :: zblocks
type(dim3), public :: zthreads

Constructor

public interface cuda_backend_t

  • public function init(mesh, allocator) result(backend)

    Arguments

    Type IntentOptional Attributes Name
    type(mesh_t), intent(inout), target :: mesh
    class(allocator_t), intent(inout), target :: allocator

    Return Value type(cuda_backend_t)


Type-Bound Procedures

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 :: alloc_tdsops => alloc_cuda_tdsops

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

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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

procedure, public :: transeq_x => transeq_x_cuda

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

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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_cuda

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

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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_cuda

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

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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_cuda

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

    Compute the convection and diffusion for the given field in the given direction. Halo exchange for the given field is necessary When sync is true, halo exchange of momentum is necessary

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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_cuda

procedure, public :: reorder => reorder_cuda

  • public subroutine reorder_cuda(self, u_o, u_i, direction)

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_backend_t) :: self
    class(field_t), intent(inout) :: u_o
    class(field_t), intent(in) :: u_i
    integer, intent(in) :: direction

procedure, public :: sum_yintox => sum_yintox_cuda

procedure, public :: sum_zintox => sum_zintox_cuda

procedure, public :: veccopy => veccopy_cuda

procedure, public :: vecadd => vecadd_cuda

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

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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_cuda

procedure, public :: scalar_product => scalar_product_cuda

procedure, public :: field_max_mean => field_max_mean_cuda

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

    m_base_backend

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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 :: field_scale => field_scale_cuda

  • public subroutine field_scale_cuda(self, f, a)

    Arguments

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

procedure, public :: field_shift => field_shift_cuda

  • public subroutine field_shift_cuda(self, f, a)

    Arguments

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

procedure, public :: field_set_face => field_set_face_cuda

  • public subroutine field_set_face_cuda(self, f, c_start, c_end, face)

    m_base_backend

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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

procedure, public :: field_volume_integral => field_volume_integral_cuda

procedure, public :: copy_data_to_f => copy_data_to_f_cuda

  • public subroutine copy_data_to_f_cuda(self, f, data)

    Arguments

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

procedure, public :: copy_f_to_data => copy_f_to_data_cuda

  • public subroutine copy_f_to_data_cuda(self, data, f)

    Arguments

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

procedure, public :: init_poisson_fft => init_cuda_poisson_fft

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

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_backend_t) :: self
    type(mesh_t), intent(in) :: 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 :: transeq_cuda_dist

  • public subroutine transeq_cuda_dist(self, du, dv, dw, u, v, w, nu, dirps, blocks, threads)

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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
    type(dim3), intent(in) :: blocks
    type(dim3), intent(in) :: threads

procedure, public :: transeq_cuda_thom

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

    Thomas algorithm implementation. So much more easier than the distributed algorithm. It is intended to work only on a single rank so there is no MPI communication.

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_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
    type(dirps_t), intent(in) :: dirps

procedure, public :: tds_solve_dist

  • public subroutine tds_solve_dist(self, du, u, tdsops, blocks, threads)

    Arguments

    Type IntentOptional Attributes Name
    class(cuda_backend_t) :: self
    class(field_t), intent(inout) :: du
    class(field_t), intent(in) :: u
    class(tdsops_t), intent(in) :: tdsops
    type(dim3), intent(in) :: blocks
    type(dim3), intent(in) :: threads