dtfft_abstract_kernel Module

This module defines abstract_kernel type and its type bound procedures.

The abstract kernel is used in reshape_handle_generic type and is resposible for packing/unpacking/permute operations. The actual implementation of the kernel is deferred to the create_private, execute_private and destroy_private procedures.


Uses

  • module~~dtfft_abstract_kernel~~UsesGraph module~dtfft_abstract_kernel dtfft_abstract_kernel iso_c_binding iso_c_binding module~dtfft_abstract_kernel->iso_c_binding iso_fortran_env iso_fortran_env module~dtfft_abstract_kernel->iso_fortran_env module~dtfft_abstract_compressor dtfft_abstract_compressor module~dtfft_abstract_kernel->module~dtfft_abstract_compressor module~dtfft_config dtfft_config module~dtfft_abstract_kernel->module~dtfft_config module~dtfft_interface_nvtx dtfft_interface_nvtx module~dtfft_abstract_kernel->module~dtfft_interface_nvtx module~dtfft_parameters dtfft_parameters module~dtfft_abstract_kernel->module~dtfft_parameters module~dtfft_utils dtfft_utils module~dtfft_abstract_kernel->module~dtfft_utils mpi_f08 mpi_f08 module~dtfft_abstract_kernel->mpi_f08 module~dtfft_abstract_compressor->iso_c_binding module~dtfft_abstract_compressor->iso_fortran_env module~dtfft_abstract_compressor->module~dtfft_interface_nvtx module~dtfft_abstract_compressor->module~dtfft_parameters module~dtfft_abstract_compressor->module~dtfft_utils module~dtfft_abstract_compressor->mpi_f08 module~dtfft_errors dtfft_errors module~dtfft_abstract_compressor->module~dtfft_errors module~dtfft_config->iso_c_binding module~dtfft_config->iso_fortran_env module~dtfft_config->module~dtfft_abstract_compressor module~dtfft_config->module~dtfft_parameters module~dtfft_config->module~dtfft_utils module~dtfft_config->mpi_f08 module~dtfft_config->module~dtfft_errors module~dtfft_interface_cuda_runtime dtfft_interface_cuda_runtime module~dtfft_config->module~dtfft_interface_cuda_runtime module~dtfft_interface_nvtx->iso_c_binding module~dtfft_interface_nvtx->module~dtfft_utils module~dtfft_parameters->iso_c_binding module~dtfft_parameters->iso_fortran_env module~dtfft_parameters->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_utils->module~dtfft_errors module~dtfft_errors->iso_fortran_env module~dtfft_interface_cuda_runtime->iso_c_binding module~dtfft_interface_cuda_runtime->iso_fortran_env module~dtfft_interface_cuda_runtime->module~dtfft_parameters module~dtfft_interface_cuda_runtime->module~dtfft_utils

Used by

  • module~~dtfft_abstract_kernel~~UsedByGraph module~dtfft_abstract_kernel dtfft_abstract_kernel module~dtfft_abstract_backend dtfft_abstract_backend module~dtfft_abstract_backend->module~dtfft_abstract_kernel module~dtfft_kernel_device dtfft_kernel_device module~dtfft_kernel_device->module~dtfft_abstract_kernel module~dtfft_nvrtc_block_optimizer dtfft_nvrtc_block_optimizer module~dtfft_kernel_device->module~dtfft_nvrtc_block_optimizer module~dtfft_nvrtc_module_cache dtfft_nvrtc_module_cache module~dtfft_kernel_device->module~dtfft_nvrtc_module_cache module~dtfft_kernel_host dtfft_kernel_host module~dtfft_kernel_host->module~dtfft_abstract_kernel module~dtfft_nvrtc_block_optimizer->module~dtfft_abstract_kernel module~dtfft_nvrtc_module dtfft_nvrtc_module module~dtfft_nvrtc_module->module~dtfft_abstract_kernel module~dtfft_nvrtc_module->module~dtfft_nvrtc_block_optimizer module~dtfft_nvrtc_module_cache->module~dtfft_abstract_kernel module~dtfft_nvrtc_module_cache->module~dtfft_nvrtc_block_optimizer module~dtfft_nvrtc_module_cache->module~dtfft_nvrtc_module module~dtfft_reshape_handle_generic dtfft_reshape_handle_generic module~dtfft_reshape_handle_generic->module~dtfft_abstract_kernel module~dtfft_reshape_handle_generic->module~dtfft_abstract_backend module~dtfft_reshape_handle_generic->module~dtfft_kernel_device module~dtfft_reshape_handle_generic->module~dtfft_kernel_host module~dtfft_abstract_reshape_handle dtfft_abstract_reshape_handle module~dtfft_reshape_handle_generic->module~dtfft_abstract_reshape_handle module~dtfft_backend_cufftmp_m dtfft_backend_cufftmp_m module~dtfft_reshape_handle_generic->module~dtfft_backend_cufftmp_m module~dtfft_backend_mpi dtfft_backend_mpi module~dtfft_reshape_handle_generic->module~dtfft_backend_mpi module~dtfft_backend_nccl_m dtfft_backend_nccl_m module~dtfft_reshape_handle_generic->module~dtfft_backend_nccl_m program~test_compression test_compression program~test_compression->module~dtfft_abstract_kernel program~test_compression->module~dtfft_kernel_host program~test_device_kernels test_device_kernels program~test_device_kernels->module~dtfft_abstract_kernel program~test_device_kernels->module~dtfft_kernel_device program~test_device_kernels->module~dtfft_kernel_host module~dtfft_abstract_reshape_handle->module~dtfft_abstract_backend module~dtfft_backend_cufftmp_m->module~dtfft_abstract_backend module~dtfft_backend_mpi->module~dtfft_abstract_backend module~dtfft_backend_nccl_m->module~dtfft_abstract_backend module~dtfft_reshape_plan dtfft_reshape_plan module~dtfft_reshape_plan->module~dtfft_abstract_backend module~dtfft_reshape_plan->module~dtfft_abstract_reshape_handle module~dtfft_reshape_plan_base dtfft_reshape_plan_base module~dtfft_reshape_plan->module~dtfft_reshape_plan_base module~dtfft_reshape_plan_base->module~dtfft_abstract_backend module~dtfft_reshape_plan_base->module~dtfft_reshape_handle_generic module~dtfft_reshape_plan_base->module~dtfft_abstract_reshape_handle module~dtfft_reshape_handle_datatype dtfft_reshape_handle_datatype module~dtfft_reshape_plan_base->module~dtfft_reshape_handle_datatype module~dtfft_transpose_plan dtfft_transpose_plan module~dtfft_transpose_plan->module~dtfft_abstract_backend module~dtfft_transpose_plan->module~dtfft_abstract_reshape_handle module~dtfft_transpose_plan->module~dtfft_reshape_plan_base program~test_host_kernels test_host_kernels program~test_host_kernels->module~dtfft_kernel_host module~dtfft_plan dtfft_plan module~dtfft_plan->module~dtfft_reshape_plan module~dtfft_plan->module~dtfft_transpose_plan module~dtfft_reshape_handle_datatype->module~dtfft_abstract_reshape_handle 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
type(kernel_type_t), public, parameter :: KERNEL_COMPRESSION = kernel_type_t(-2)

Only compression/decompression kernel

type(kernel_type_t), public, parameter :: KERNEL_DUMMY = kernel_type_t(-1)

Dummy kernel, does nothing

type(kernel_type_t), public, parameter :: KERNEL_PACK = kernel_type_t(1)

Packs local buffer into contiguous memory

type(kernel_type_t), public, parameter :: KERNEL_COPY_PIPELINED = kernel_type_t(2)

Performs partial buffer copy

type(kernel_type_t), public, parameter :: KERNEL_UNPACK = kernel_type_t(3)

Unpacks contiguous buffer into strided layout

type(kernel_type_t), public, parameter :: KERNEL_COPY = kernel_type_t(4)

Performs buffer copy

type(kernel_type_t), public, parameter :: KERNEL_UNPACK_PIPELINED = kernel_type_t(5)

Unpacks only single part of contiguous buffer into strided layout

type(kernel_type_t), public, parameter :: KERNEL_PACK_PIPELINED = kernel_type_t(6)

Packs only single part of local buffer into contiguous memory

type(kernel_type_t), public, parameter :: KERNEL_PERMUTE_FORWARD = kernel_type_t(7)

Local permutation forward: XYZ -> YZX

type(kernel_type_t), public, parameter :: KERNEL_PERMUTE_BACKWARD = kernel_type_t(8)

Local permutation backward: ZXY -> YZX

type(kernel_type_t), public, parameter :: KERNEL_PERMUTE_BACKWARD_START = kernel_type_t(9)

Starts Local permutation backward: ZXY -> YXZ

type(kernel_type_t), public, parameter :: KERNEL_PERMUTE_BACKWARD_END = kernel_type_t(10)

Ends Local permutation backward: YXZ -> YZX

type(kernel_type_t), public, parameter :: KERNEL_PERMUTE_BACKWARD_END_PIPELINED = kernel_type_t(11)

Ends Local permutation backward: YXZ -> YZX. only partial permutation is performed

type(kernel_type_t), public, parameter :: KERNEL_PACK_FORWARD = kernel_type_t(12)

Partial forward permutation

type(kernel_type_t), public, parameter :: KERNEL_PACK_BACKWARD = kernel_type_t(13)

Partial backward permutation

type(kernel_type_t), public, parameter :: KERNEL_UNPACK_FORWARD = kernel_type_t(15)

Unpacks contiguous buffer into strided layout and perform forward permutation

type(kernel_type_t), public, parameter :: KERNEL_UNPACK_FORWARD_PIPELINED = kernel_type_t(16)

Unpacks only single part of contiguous buffer into strided layout and perform forward permutation

type(kernel_type_t), public, parameter :: KERNEL_UNPACK_BACKWARD = kernel_type_t(17)

Unpacks contiguous buffer into strided layout and perform backward permutation

type(kernel_type_t), public, parameter :: KERNEL_UNPACK_BACKWARD_PIPELINED = kernel_type_t(18)

Unpacks only single part of contiguous buffer into strided layout and perform backward permutation

type(kernel_type_t), private, parameter :: TRANSPOSE_KERNELS(*) = [KERNEL_PERMUTE_FORWARD, KERNEL_PERMUTE_BACKWARD, KERNEL_PERMUTE_BACKWARD_START, KERNEL_PACK_FORWARD, KERNEL_PACK_BACKWARD, KERNEL_UNPACK_FORWARD_PIPELINED, KERNEL_UNPACK_BACKWARD_PIPELINED]
type(kernel_type_t), private, parameter :: UNPACK_KERNELS(*) = [KERNEL_PERMUTE_BACKWARD_END, KERNEL_PERMUTE_BACKWARD_END_PIPELINED, KERNEL_UNPACK, KERNEL_UNPACK_PIPELINED, KERNEL_UNPACK_FORWARD, KERNEL_UNPACK_FORWARD_PIPELINED, KERNEL_UNPACK_BACKWARD, KERNEL_UNPACK_BACKWARD_PIPELINED]

List of all unpack kernel types

type(kernel_type_t), private, parameter :: PACK_KERNELS(*) = [KERNEL_PACK, KERNEL_COPY_PIPELINED, KERNEL_PACK_PIPELINED, KERNEL_PACK_FORWARD, KERNEL_PACK_BACKWARD]

List of all pack kernel types


Interfaces

public interface operator(==)

  • private pure elemental function kernel_type_eq(left, right) result(res)

    Arguments

    Type IntentOptional Attributes Name
    type(kernel_type_t), intent(in) :: left
    type(kernel_type_t), intent(in) :: right

    Return Value logical

public interface operator(/=)

  • private pure elemental function kernel_type_ne(left, right) result(res)

    Arguments

    Type IntentOptional Attributes Name
    type(kernel_type_t), intent(in) :: left
    type(kernel_type_t), intent(in) :: right

    Return Value logical


Abstract Interfaces

abstract interface

  • private subroutine create_interface(self, effort, base_storage, force_effort)

    Creates underlying kernel

    Arguments

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

    Abstract kernel

    type(dtfft_effort_t), intent(in) :: effort

    Effort level for generating transpose kernels

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

    Number of bytes needed to store single element

    logical, intent(in), optional :: force_effort

    Should effort be forced or not

abstract interface

  • private subroutine execute_interface(self, in, out, stream, sync, neighbor)

    Executes underlying kernel

    Arguments

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

    Abstract kernel

    type(c_ptr), intent(in) :: in

    Source buffer, can be device or host pointer

    type(c_ptr), intent(in) :: out

    Target buffer, can be device or host pointer

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

    Stream to execute on, used only for device pointers

    logical, intent(in) :: sync

    Sync stream after kernel execution

    integer(kind=int32), intent(in), optional :: neighbor

    Source rank for pipelined unpacking

abstract interface

  • private subroutine destroy_interface(self)

    Destroys underlying kernel

    Arguments

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

    Abstract kernel


Derived Types

type, public ::  kernel_type_t

Type of kernel

Components

Type Visibility Attributes Name Initial
integer(kind=int32), public :: val

type, public, abstract ::  abstract_kernel

Abstract kernel type

Read more…

Components

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

Kernel is created flag.

logical, public :: is_dummy = .false.

If kernel should do anything or not.

logical, public :: is_dummy_kernel = .false.

If kernel is of type KERNEL_DUMMY

logical, public :: is_dummy_compressed = .false.
type(kernel_type_t), public :: kernel_type

Type of the kernel

type(string), public :: kernel_string
integer(kind=int32), public, allocatable :: neighbor_data(:,:)

Neighbor data for pipelined unpacking

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

Local dimensions to process

class(abstract_compressor), public, pointer :: compressor

Compressor pointer. Compressor itself is created by generic handle and passed here

logical, public :: is_compress

Enable compression

logical, public :: is_decompress

Enable decompression

integer(kind=int64), public :: base_storage

Type-Bound Procedures

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

Creates kernel

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

Executes kernel

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

Destroys kernel

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

Creates underlying kernel

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

Executes underlying kernel

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

Destroys underlying kernel


Functions

public function get_kernel_string(kernel) result(str)

Gets the string description of a kernel

Arguments

Type IntentOptional Attributes Name
type(kernel_type_t), intent(in) :: kernel

kernel type

Return Value type(string)

kernel string

public function get_fused(kernel) result(fused)

Converts kernel to its fused version if applicable

Arguments

Type IntentOptional Attributes Name
type(kernel_type_t), intent(in) :: kernel

kernel type

Return Value type(kernel_type_t)

fused kernel type

public pure elemental function is_transpose_kernel(param) result(res)

Arguments

Type IntentOptional Attributes Name
type(kernel_type_t), intent(in) :: param

Return Value logical

public pure elemental function is_unpack_kernel(param) result(res)

Arguments

Type IntentOptional Attributes Name
type(kernel_type_t), intent(in) :: param

Return Value logical

public pure elemental function is_pack_kernel(param) result(res)

Arguments

Type IntentOptional Attributes Name
type(kernel_type_t), intent(in) :: param

Return Value logical

private elemental function bytes_to_floats(bytes) result(floats)

Converts number of bytes to number of floats needed to store them

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: bytes

Number of bytes

Return Value integer(kind=int32)

Number of floats

private pure elemental function kernel_type_eq(left, right) result(res)

Arguments

Type IntentOptional Attributes Name
type(kernel_type_t), intent(in) :: left
type(kernel_type_t), intent(in) :: right

Return Value logical

private pure elemental function kernel_type_ne(left, right) result(res)

Arguments

Type IntentOptional Attributes Name
type(kernel_type_t), intent(in) :: left
type(kernel_type_t), intent(in) :: right

Return Value logical


Subroutines

private subroutine create(self, dims, effort, base_storage, kernel_type, neighbor_data, force_effort, with_compression, with_decompression)

Creates kernel

Arguments

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

Abstract kernel

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

Local dimensions to process

type(dtfft_effort_t), intent(in) :: effort

Effort level for generating transpose kernels

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

Number of bytes needed to store single element

type(kernel_type_t), intent(in) :: kernel_type

Type of kernel to build

integer(kind=int32), intent(in), optional :: neighbor_data(:,:)

Optional pointers for unpack kernels

logical, intent(in), optional :: force_effort

Should effort be forced or not

logical, intent(in), optional :: with_compression

Enable compression after executing kernel

logical, intent(in), optional :: with_decompression

Enable decompression before executing kernel

private subroutine execute(self, in, out, stream, neighbor, aux, csize, csizes, skip_compression, skip_rank, sync)

Executes kernel

Arguments

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

Abstract kernel

type(c_ptr), intent(in) :: in

Source buffer, can be device or host pointer

type(c_ptr), intent(in) :: out

Target buffer, can be device or host pointer

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

Stream to execute on, used only for device pointers

integer(kind=int32), intent(in), optional :: neighbor

Source rank for pipelined unpacking

type(c_ptr), intent(in), optional :: aux

Target buffer, can be device or host pointer

integer(kind=int32), intent(inout), optional :: csize

Compressed buffer size

integer(kind=int32), intent(inout), optional :: csizes(:)

Multiple compression sizes. This should only be used with CUDA backends

logical, intent(in), optional :: skip_compression

Skip compression/decompression stage. Should be used when packing/unpacking from itself.

integer(kind=int32), intent(in), optional :: skip_rank

Skip compression/decompression for specific rank when neighbor is not specified.

logical, intent(in), optional :: sync

Sync stream after packing/compression. Should be used only for fused backends

private subroutine set_compressor(self, compressor)

Sets created compressor for the kernel

Arguments

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

Abstract kernel

class(abstract_compressor), intent(in), target :: compressor

Compressor to set

private subroutine destroy(self)

Destroys kernel

Arguments

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

Abstract kernel