dtfft_abstract_backend Module

This module describes Abstraction for all GPU Backends: abstract_backend


Uses

  • module~~dtfft_abstract_backend~~UsesGraph module~dtfft_abstract_backend dtfft_abstract_backend iso_c_binding iso_c_binding module~dtfft_abstract_backend->iso_c_binding iso_fortran_env iso_fortran_env module~dtfft_abstract_backend->iso_fortran_env module~dtfft_interface_cuda_runtime dtfft_interface_cuda_runtime module~dtfft_abstract_backend->module~dtfft_interface_cuda_runtime module~dtfft_interface_nccl dtfft_interface_nccl module~dtfft_abstract_backend->module~dtfft_interface_nccl module~dtfft_nvrtc_kernel dtfft_nvrtc_kernel module~dtfft_abstract_backend->module~dtfft_nvrtc_kernel module~dtfft_parameters dtfft_parameters module~dtfft_abstract_backend->module~dtfft_parameters module~dtfft_pencil dtfft_pencil module~dtfft_abstract_backend->module~dtfft_pencil module~dtfft_utils dtfft_utils module~dtfft_abstract_backend->module~dtfft_utils mpi_f08 mpi_f08 module~dtfft_abstract_backend->mpi_f08 module~dtfft_interface_cuda_runtime->iso_c_binding module~dtfft_interface_cuda_runtime->module~dtfft_parameters module~dtfft_interface_cuda_runtime->module~dtfft_utils module~dtfft_interface_nccl->iso_c_binding module~dtfft_interface_nccl->module~dtfft_parameters module~dtfft_interface_nccl->module~dtfft_utils module~dtfft_nvrtc_kernel->iso_c_binding module~dtfft_nvrtc_kernel->iso_fortran_env module~dtfft_nvrtc_kernel->module~dtfft_interface_cuda_runtime module~dtfft_nvrtc_kernel->module~dtfft_parameters module~dtfft_nvrtc_kernel->module~dtfft_utils module~dtfft_nvrtc_kernel->mpi_f08 module~dtfft_interface_cuda dtfft_interface_cuda module~dtfft_nvrtc_kernel->module~dtfft_interface_cuda module~dtfft_interface_nvrtc dtfft_interface_nvrtc module~dtfft_nvrtc_kernel->module~dtfft_interface_nvrtc module~dtfft_interface_nvtx dtfft_interface_nvtx module~dtfft_nvrtc_kernel->module~dtfft_interface_nvtx module~dtfft_parameters->iso_c_binding module~dtfft_parameters->iso_fortran_env module~dtfft_parameters->mpi_f08 module~dtfft_pencil->iso_c_binding module~dtfft_pencil->iso_fortran_env module~dtfft_pencil->module~dtfft_interface_cuda_runtime module~dtfft_pencil->module~dtfft_parameters module~dtfft_pencil->module~dtfft_utils module~dtfft_pencil->mpi_f08 module~dtfft_utils->iso_c_binding module~dtfft_utils->iso_fortran_env module~dtfft_utils->module~dtfft_parameters module~dtfft_utils->mpi_f08 module~dtfft_interface_cuda->iso_c_binding module~dtfft_interface_cuda->iso_fortran_env module~dtfft_interface_cuda->module~dtfft_interface_cuda_runtime module~dtfft_interface_cuda->module~dtfft_parameters module~dtfft_interface_cuda->module~dtfft_utils module~dtfft_interface_nvrtc->iso_c_binding module~dtfft_interface_nvrtc->iso_fortran_env module~dtfft_interface_nvrtc->module~dtfft_interface_cuda_runtime module~dtfft_interface_nvrtc->module~dtfft_parameters module~dtfft_interface_nvrtc->module~dtfft_utils module~dtfft_interface_nvtx->iso_c_binding module~dtfft_interface_nvtx->module~dtfft_utils

Used by

  • module~~dtfft_abstract_backend~~UsedByGraph module~dtfft_abstract_backend dtfft_abstract_backend module~dtfft_abstract_transpose_plan dtfft_abstract_transpose_plan module~dtfft_abstract_transpose_plan->module~dtfft_abstract_backend module~dtfft_backend_cufftmp_m dtfft_backend_cufftmp_m module~dtfft_backend_cufftmp_m->module~dtfft_abstract_backend module~dtfft_backend_mpi dtfft_backend_mpi module~dtfft_backend_mpi->module~dtfft_abstract_backend module~dtfft_backend_nccl_m dtfft_backend_nccl_m module~dtfft_backend_nccl_m->module~dtfft_abstract_backend module~dtfft_transpose_handle_cuda dtfft_transpose_handle_cuda module~dtfft_transpose_handle_cuda->module~dtfft_abstract_backend module~dtfft_transpose_handle_cuda->module~dtfft_backend_cufftmp_m module~dtfft_transpose_handle_cuda->module~dtfft_backend_mpi module~dtfft_transpose_handle_cuda->module~dtfft_backend_nccl_m module~dtfft_transpose_plan_cuda dtfft_transpose_plan_cuda module~dtfft_transpose_plan_cuda->module~dtfft_abstract_backend module~dtfft_transpose_plan_cuda->module~dtfft_abstract_transpose_plan module~dtfft_transpose_plan_cuda->module~dtfft_transpose_handle_cuda module~dtfft_plan dtfft_plan module~dtfft_plan->module~dtfft_abstract_transpose_plan module~dtfft_plan->module~dtfft_transpose_plan_cuda module~dtfft_transpose_plan_host dtfft_transpose_plan_host module~dtfft_plan->module~dtfft_transpose_plan_host module~dtfft_transpose_plan_host->module~dtfft_abstract_transpose_plan module~dtfft dtfft module~dtfft->module~dtfft_plan module~dtfft_api dtfft_api module~dtfft_api->module~dtfft_plan

Variables

Type Visibility Attributes Name Initial
integer(kind=int32), public, parameter :: NCCL_REGISTER_PREALLOC_SIZE = 8

Abstract Interfaces

abstract interface

  • private subroutine create_interface(self, helper, tranpose_type, base_storage)

    Creates overring class

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_backend), intent(inout) :: self

    Abstract GPU Backend

    type(backend_helper), intent(in) :: helper

    Backend helper

    type(dtfft_transpose_t), intent(in) :: tranpose_type

    Type of transpose to create

    integer(kind=int64), intent(in) :: base_storage

    Number of bytes to store single element

abstract interface

  • private subroutine execute_interface(self, in, out, stream, aux)

    Executes GPU Backend

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_backend), intent(inout) :: self

    Abstract GPU Backend

    real(kind=real32), intent(inout), target :: in(:)

    Send pointer

    real(kind=real32), intent(inout), target :: out(:)

    Recv pointer

    type(dtfft_stream_t), intent(in) :: stream

    Main execution CUDA stream

    real(kind=real32), intent(inout), target :: aux(:)

    Aux pointer

abstract interface

  • private subroutine destroy_interface(self)

    Destroys overring class

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_backend), intent(inout) :: self

    Abstract GPU Backend


Derived Types

type, public ::  backend_helper

Helper with nccl, mpi and nvshmem communicators

Components

Type Visibility Attributes Name Initial
logical, public :: is_nccl_created = .false.

Flag is nccl_comm has been created

type(ncclComm), public :: nccl_comm

NCCL communicator

logical, public :: should_register

If NCCL buffer should be registered

type(c_ptr), public, allocatable :: nccl_register(:,:)

NCCL register cache

integer(kind=int32), public :: nccl_register_size

Number of elements in nccl_register

type(MPI_Comm), public, allocatable :: comms(:)

MPI communicators

integer(kind=int32), public, allocatable :: comm_mappings(:,:)

Mapping of 1d comm ranks to global comm

type(dtfft_transpose_t), public :: tranpose_type

Type of transpose to create

type(pencil), public, pointer :: pencils(:)

Pencils

Type-Bound Procedures

procedure, public, pass(self) :: create => create_helper ../../

Creates helper

procedure, public, pass(self) :: destroy => destroy_helper ../../

Destroys helper

type, public, abstract ::  abstract_backend

The most Abstract GPU Backend

Components

Type Visibility Attributes Name Initial
type(dtfft_backend_t), public :: backend

Backend type

logical, public :: is_selfcopy

If backend is self-copying

logical, public :: is_pipelined

If backend is pipelined

integer(kind=int64), public :: aux_size

Number of bytes required by aux buffer

integer(kind=int64), public :: send_recv_buffer_size

Number of float elements used in c_f_pointer

type(MPI_Comm), public :: comm

MPI Communicator

integer(kind=int32), public, allocatable :: comm_mapping(:)

Mapping of 1d comm ranks to global comm

integer(kind=int32), public :: comm_size

Size of MPI Comm

integer(kind=int32), public :: comm_rank

Rank in MPI Comm

integer(kind=int64), public, allocatable :: send_displs(:)

Send data displacements, in float elements

integer(kind=int64), public, allocatable :: send_floats(:)

Send data elements, in float elements

integer(kind=int64), public, allocatable :: recv_displs(:)

Recv data displacements, in float elements

integer(kind=int64), public, allocatable :: recv_floats(:)

Recv data elements, in float elements

type(cudaEvent), public :: execution_event

Event for main execution stream

type(cudaEvent), public :: copy_event

Event for copy stream

type(dtfft_stream_t), public :: copy_stream

Stream for copy operations

integer(kind=int64), public :: self_copy_bytes

Number of bytes to copy it itself

integer(kind=int64), public :: self_send_displ

Displacement for send buffer

integer(kind=int64), public :: self_recv_displ

Displacement for recv buffer

type(nvrtc_kernel), public, pointer :: unpack_kernel

Kernel for unpacking data

type(nvrtc_kernel), public, pointer :: unpack_kernel2

Kernel for unpacking data

Type-Bound Procedures

procedure, public, non_overridable, pass(self) :: create ../../

Creates Abstract GPU Backend

procedure, public, non_overridable, pass(self) :: execute ../../

Executes GPU Backend

procedure, public, non_overridable, pass(self) :: destroy ../../

Destroys Abstract GPU Backend

procedure, public, non_overridable, pass(self) :: get_aux_size ../../

Returns number of bytes required by aux buffer

procedure, public, non_overridable, pass(self) :: set_unpack_kernel ../../

Sets unpack kernel for pipelined backend

procedure(create_interface), public, deferred, pass(self) :: create_private ../../

Creates overring class

procedure(execute_interface), public, deferred, pass(self) :: execute_private ../../

Executes GPU Backend

procedure(destroy_interface), public, deferred, pass(self) :: destroy_private ../../

Destroys overring class


Functions

private function get_aux_size(self)

Returns number of bytes required by aux buffer

Arguments

Type IntentOptional Attributes Name
class(abstract_backend), intent(in) :: self

Abstract GPU backend

Return Value integer(kind=int64)


Subroutines

private subroutine create(self, backend, tranpose_type, helper, comm_id, send_displs, send_counts, recv_displs, recv_counts, base_storage)

Creates Abstract GPU Backend

Arguments

Type IntentOptional Attributes Name
class(abstract_backend), intent(inout) :: self

Abstract GPU Backend

type(dtfft_backend_t), intent(in) :: backend

GPU Backend type

type(dtfft_transpose_t), intent(in) :: tranpose_type

Type of transpose to create

type(backend_helper), intent(in) :: helper

Backend helper

integer(kind=int8), intent(in) :: comm_id

Id of communicator to use

integer(kind=int32), intent(in) :: send_displs(:)

Send data displacements, in original elements

integer(kind=int32), intent(in) :: send_counts(:)

Send data elements, in float elements

integer(kind=int32), intent(in) :: recv_displs(:)

Recv data displacements, in float elements

integer(kind=int32), intent(in) :: recv_counts(:)

Recv data elements, in float elements

integer(kind=int64), intent(in) :: base_storage

Number of bytes to store single element

private subroutine execute(self, in, out, stream, aux)

Executes GPU Backend

Arguments

Type IntentOptional Attributes Name
class(abstract_backend), intent(inout) :: self

Self-copying backend

real(kind=real32), intent(inout) :: in(:)

Send pointer

real(kind=real32), intent(inout) :: out(:)

Recv pointer

type(dtfft_stream_t), intent(in) :: stream

CUDA stream

real(kind=real32), intent(inout) :: aux(:)

Aux pointer

private subroutine destroy(self)

Destroys Abstract GPU Backend

Arguments

Type IntentOptional Attributes Name
class(abstract_backend), intent(inout) :: self

Abstract GPU backend

private subroutine set_unpack_kernel(self, unpack_kernel, unpack_kernel2)

Sets unpack kernel for pipelined backend

Arguments

Type IntentOptional Attributes Name
class(abstract_backend), intent(inout) :: self

Pipelined backend

type(nvrtc_kernel), intent(in), target :: unpack_kernel

Kernel for unpacking data

type(nvrtc_kernel), intent(in), optional, target :: unpack_kernel2

Kernel for unpacking data

private subroutine create_helper(self, base_comm, comms, is_nccl_needed, pencils)

Creates helper

Arguments

Type IntentOptional Attributes Name
class(backend_helper), intent(inout) :: self

Backend helper

type(MPI_Comm), intent(in) :: base_comm

MPI communicator

type(MPI_Comm), intent(in) :: comms(:)

1D Communicators

logical, intent(in) :: is_nccl_needed

If nccl communicator will be needed

type(pencil), intent(in), target :: pencils(:)

Pencils

private subroutine destroy_helper(self)

Destroys helper

Arguments

Type IntentOptional Attributes Name
class(backend_helper), intent(inout) :: self

Backend helper