transpose_plan_host Derived Type

type, public, extends(abstract_transpose_plan) :: transpose_plan_host

Host transpose plan


Inherits

type~~transpose_plan_host~~InheritsGraph type~transpose_plan_host transpose_plan_host type~abstract_transpose_plan abstract_transpose_plan type~transpose_plan_host->type~abstract_transpose_plan type~transpose_handle_host transpose_handle_host type~transpose_plan_host->type~transpose_handle_host fplans, bplans type~backend_helper backend_helper type~abstract_transpose_plan->type~backend_helper helper type~dtfft_backend_t dtfft_backend_t type~abstract_transpose_plan->type~dtfft_backend_t backend MPI_Comm MPI_Comm type~transpose_handle_host->MPI_Comm comm MPI_Request MPI_Request type~transpose_handle_host->MPI_Request request type~handle_t handle_t type~transpose_handle_host->type~handle_t send, recv type~backend_helper->MPI_Comm comms c_ptr c_ptr type~backend_helper->c_ptr nccl_register type~dtfft_transpose_t dtfft_transpose_t type~backend_helper->type~dtfft_transpose_t tranpose_type type~ncclcomm ncclComm type~backend_helper->type~ncclcomm nccl_comm type~pencil pencil type~backend_helper->type~pencil pencils MPI_Datatype MPI_Datatype type~handle_t->MPI_Datatype dtypes type~ncclcomm->c_ptr member

Components

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

GPU backend

type(backend_helper), public :: helper

Backend helper

logical, public :: is_z_slab

Z-slab optimization flag (for 3D transforms)

integer(kind=int64), public :: min_buffer_size

Minimal buffer size for transposition

type(transpose_handle_host), private, allocatable :: fplans(:)

Forward plans

type(transpose_handle_host), private, allocatable :: bplans(:)

Backward plans


Type-Bound Procedures

procedure, public, pass(self) :: create

Create transposition plan

  • private function create(self, dims, base_comm_, effort, base_dtype, base_storage, cart_comm, comms, pencils) result(error_code)

    Creates transposition plans

    Arguments

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

    Transposition class

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

    Global sizes of the transform requested

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

    Base communicator

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

    dtFFT planner type of effort

    type(MPI_Datatype), intent(in) :: base_dtype

    Base MPI_Datatype

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

    Number of bytes needed to store single element

    type(MPI_Comm), intent(out) :: cart_comm

    Cartesian communicator

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

    Array of 1d communicators

    type(pencil), intent(out) :: pencils(:)

    Data distributing meta

    Return Value integer(kind=int32)

    Error code

procedure, public, pass(self) :: execute

Executes transposition

  • private subroutine execute(self, in, out, transpose_type)

    Executes single transposition

    Arguments

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

    Transposition class

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

    Incoming pointer

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

    Result pointer

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

    Type of transpose

procedure, public, non_overridable, pass(self) :: get_backend

Returns backend id

procedure, public, non_overridable, pass(self) :: mem_alloc

Allocates memory based on selected backend

  • private subroutine mem_alloc(self, comm, alloc_bytes, ptr, error_code)

    Allocates memory based on selected backend

    Arguments

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

    Transposition class

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

    MPI communicator

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

    Number of bytes to allocate

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

    Pointer to the allocated memory

    integer(kind=int32), intent(out) :: error_code

    Error code

procedure, public, non_overridable, pass(self) :: mem_free

Frees memory allocated with mem_alloc

  • private subroutine mem_free(self, ptr, error_code)

    Frees memory allocated with mem_alloc

    Arguments

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

    Transposition class

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

    Pointer to the memory to free

    integer(kind=int32), intent(out) :: error_code

    Error code

procedure, public :: create_private

  • private function create_private(self, dims, transposed_dims, base_comm, comm_dims, effort, base_dtype, base_storage, is_custom_cart_comm, cart_comm, comms, pencils) result(error_code)

    Creates transposition plans

    Arguments

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

    Transposition class

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

    Global sizes of the transform requested

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

    Transposed sizes of the transform requested

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

    Base communicator

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

    Number of MPI Processes in all directions

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

    How thoroughly dtFFT searches for the optimal plan

    type(MPI_Datatype), intent(in) :: base_dtype

    Base MPI_Datatype

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

    Number of bytes needed to store single element

    logical, intent(in) :: is_custom_cart_comm

    Is custom Cartesian communicator provided by user

    type(MPI_Comm), intent(out) :: cart_comm

    Cartesian communicator

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

    Array of 1d communicators

    type(pencil), intent(out) :: pencils(:)

    Pencils

    Return Value integer(kind=int32)

    Error code

procedure, public :: execute_private

  • private subroutine execute_private(self, in, out, transpose_type)

    Executes single transposition

    Arguments

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

    Transposition class

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

    Incoming buffer

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

    Resulting buffer

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

    Type of transpose to execute

procedure, public :: destroy

  • private subroutine destroy(self)

    Destroys transposition plans

    Arguments

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

    Transposition class

procedure, private, nopass :: get_plan_execution_time

  • private function get_plan_execution_time(comm, cart_comm, from, to, base_dtype, base_storage, datatype_id, transpose_name_id, a, b) result(elapsed_time)

    Creates transpose plan and executes it DTFFT_MEASURE_WARMUP_ITERS + DTFFT_MEASURE_ITERS times

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    type(MPI_Comm), intent(in) :: comm

    1D comm in case of pencils, 3D comm in case of z_slabs

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

    3D Cartesian comm

    type(pencil), intent(in) :: from

    Source meta

    type(pencil), intent(in) :: to

    Target meta

    type(MPI_Datatype), intent(in) :: base_dtype

    Basic MPI Datatype

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

    Number of bytes needed to store Basic MPI Datatype

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

    ID of transpose (1 or 2)

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

    ID of transpose name (from -3 to 3, except 0)

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

    Source buffer

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

    Target buffer

    Return Value real(kind=real64)

    Execution time

procedure, private, pass(self) :: autotune_transpose_id

  • private function autotune_transpose_id(self, comm, cart_comm, from, to, base_dtype, base_storage, transpose_name_id, a, b, forward_id, backward_id) result(elapsed_time)

    Creates forward and backward transpose plans bases on source and target data distributing, executes them DTFFT_MEASURE_ITERS times ( 4 * DTFFT_MEASURE_ITERS iterations total )

    Read more…

    Arguments

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

    Abstract plan

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

    1D comm in case of pencils, 3D comm in case of z_slabs

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

    3D Cartesian comm

    type(pencil), intent(in) :: from

    Source meta

    type(pencil), intent(in) :: to

    Target meta

    type(MPI_Datatype), intent(in) :: base_dtype

    Basic MPI Datatype

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

    Number of bytes needed to store Basic MPI Datatype

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

    ID of transpose name (from -3 to 3, except 0)

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

    Source buffer

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

    Target buffer

    integer(kind=int8), intent(out) :: forward_id

    Best forward plan ID

    integer(kind=int8), intent(out) :: backward_id

    Best backward plan ID

    Return Value real(kind=real64)

    Elapsed time for best plans selected

procedure, private, pass(self) :: autotune_mpi_datatypes

  • private subroutine autotune_mpi_datatypes(self, pencils, cart_comm, comms, base_dtype, base_storage, a, b, forward_ids, backward_ids, elapsed_time)

    Arguments

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

    Host plan

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

    Array of pencils

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

    3D Cartesian comm

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

    Array of 1d communicators

    type(MPI_Datatype), intent(in) :: base_dtype

    Basic MPI Datatype

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

    Number of bytes needed to store Basic MPI Datatype

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

    Work buffer

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

    Work buffer

    integer(kind=int8), intent(inout) :: forward_ids(:)

    Forward plan IDs

    integer(kind=int8), intent(inout) :: backward_ids(:)

    Backward plan IDs

    real(kind=real64), intent(out) :: elapsed_time

    Elapsed time

procedure, private, pass(self) :: autotune_grid_decomposition

  • private subroutine autotune_grid_decomposition(self, dims, transposed_dims, base_comm, effort, n_transpose_plans, base_dtype, base_storage, best_comm_dims, best_forward_ids, best_backward_ids)

    Runs through all possible grid decompositions and selects the best one based on the lowest average execution time

    Arguments

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

    Abstract plan

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

    Global dims

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

    Transposed dims

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

    Base communicator

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

    How thoroughly dtFFT searches for the optimal plan

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

    Number of transpose plans to test

    type(MPI_Datatype), intent(in) :: base_dtype

    Base MPI_Datatype

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

    Number of bytes needed to store single element

    integer(kind=int32), intent(out) :: best_comm_dims(:)

    Best communicator dimensions

    integer(kind=int8), intent(inout) :: best_forward_ids(:)

    Best Datatype ids for forward plan

    integer(kind=int8), intent(inout) :: best_backward_ids(:)

    Best Datatype ids for backward plan

procedure, private, pass(self) :: autotune_grid

  • private subroutine autotune_grid(self, base_comm, comm_dims, dims, transposed_dims, effort, base_dtype, base_storage, latest_timer_id, timers, decomps, forw_ids, back_ids)

    Creates cartesian communicator and executes various datatypes on it

    Arguments

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

    Abstract plan

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

    Base communicator

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

    Number of MPI Processes in Y and Z directions

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

    Global dims

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

    Transposed dims

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

    How thoroughly dtFFT searches for the optimal plan

    type(MPI_Datatype), intent(in) :: base_dtype

    Basic MPI Datatype

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

    Number of bytes needed to store Basic MPI Datatype

    integer(kind=int32), intent(inout) :: latest_timer_id

    Current timer id

    real(kind=real64), intent(inout) :: timers(:)

    Time of current function execution is stored in timers(latest_timer_id)

    integer(kind=int32), intent(inout) :: decomps(:,:)

    Current decomposition is stored in decomps(:, latest_timer_id)

    integer(kind=int8), intent(inout) :: forw_ids(:,:)

    Best Forward ids are stored in forw_ids(:, latest_timer_id)

    integer(kind=int8), intent(inout) :: back_ids(:,:)

    Best Backward ids are stored in back_ids(:, latest_timer_id)