dtfft_transpose_plan_host Module

This module describes transpose_plan_host class


Uses

  • module~~dtfft_transpose_plan_host~~UsesGraph module~dtfft_transpose_plan_host dtfft_transpose_plan_host iso_fortran_env iso_fortran_env module~dtfft_transpose_plan_host->iso_fortran_env module~dtfft_abstract_transpose_plan dtfft_abstract_transpose_plan module~dtfft_transpose_plan_host->module~dtfft_abstract_transpose_plan module~dtfft_interface_nvtx dtfft_interface_nvtx module~dtfft_transpose_plan_host->module~dtfft_interface_nvtx module~dtfft_parameters dtfft_parameters module~dtfft_transpose_plan_host->module~dtfft_parameters module~dtfft_pencil dtfft_pencil module~dtfft_transpose_plan_host->module~dtfft_pencil module~dtfft_transpose_handle_host dtfft_transpose_handle_host module~dtfft_transpose_plan_host->module~dtfft_transpose_handle_host module~dtfft_utils dtfft_utils module~dtfft_transpose_plan_host->module~dtfft_utils mpi_f08 mpi_f08 module~dtfft_transpose_plan_host->mpi_f08 module~dtfft_abstract_transpose_plan->iso_fortran_env module~dtfft_abstract_transpose_plan->module~dtfft_interface_nvtx module~dtfft_abstract_transpose_plan->module~dtfft_parameters module~dtfft_abstract_transpose_plan->module~dtfft_pencil module~dtfft_abstract_transpose_plan->module~dtfft_utils module~dtfft_abstract_transpose_plan->mpi_f08 iso_c_binding iso_c_binding module~dtfft_abstract_transpose_plan->iso_c_binding module~dtfft_abstract_backend dtfft_abstract_backend module~dtfft_abstract_transpose_plan->module~dtfft_abstract_backend module~dtfft_config dtfft_config module~dtfft_abstract_transpose_plan->module~dtfft_config module~dtfft_interface_cuda_runtime dtfft_interface_cuda_runtime module~dtfft_abstract_transpose_plan->module~dtfft_interface_cuda_runtime module~dtfft_interface_nccl dtfft_interface_nccl module~dtfft_abstract_transpose_plan->module~dtfft_interface_nccl module~dtfft_interface_nvshmem dtfft_interface_nvshmem module~dtfft_abstract_transpose_plan->module~dtfft_interface_nvshmem module~dtfft_nvrtc_kernel dtfft_nvrtc_kernel module~dtfft_abstract_transpose_plan->module~dtfft_nvrtc_kernel module~dtfft_interface_nvtx->module~dtfft_utils module~dtfft_interface_nvtx->iso_c_binding module~dtfft_parameters->iso_fortran_env module~dtfft_parameters->mpi_f08 module~dtfft_parameters->iso_c_binding module~dtfft_pencil->iso_fortran_env module~dtfft_pencil->module~dtfft_parameters module~dtfft_pencil->module~dtfft_utils module~dtfft_pencil->mpi_f08 module~dtfft_pencil->iso_c_binding module~dtfft_pencil->module~dtfft_interface_cuda_runtime module~dtfft_transpose_handle_host->iso_fortran_env module~dtfft_transpose_handle_host->module~dtfft_interface_nvtx module~dtfft_transpose_handle_host->module~dtfft_parameters module~dtfft_transpose_handle_host->module~dtfft_pencil module~dtfft_transpose_handle_host->mpi_f08 module~dtfft_utils->iso_fortran_env module~dtfft_utils->module~dtfft_parameters module~dtfft_utils->mpi_f08 module~dtfft_utils->iso_c_binding module~dtfft_abstract_backend->iso_fortran_env module~dtfft_abstract_backend->module~dtfft_parameters module~dtfft_abstract_backend->module~dtfft_pencil module~dtfft_abstract_backend->module~dtfft_utils module~dtfft_abstract_backend->mpi_f08 module~dtfft_abstract_backend->iso_c_binding module~dtfft_abstract_backend->module~dtfft_interface_cuda_runtime module~dtfft_abstract_backend->module~dtfft_interface_nccl module~dtfft_abstract_backend->module~dtfft_nvrtc_kernel module~dtfft_config->iso_fortran_env module~dtfft_config->module~dtfft_parameters module~dtfft_config->module~dtfft_utils module~dtfft_config->mpi_f08 module~dtfft_config->iso_c_binding module~dtfft_config->module~dtfft_interface_cuda_runtime module~dtfft_interface_cuda_runtime->module~dtfft_parameters module~dtfft_interface_cuda_runtime->module~dtfft_utils module~dtfft_interface_cuda_runtime->iso_c_binding module~dtfft_interface_nccl->module~dtfft_parameters module~dtfft_interface_nccl->module~dtfft_utils module~dtfft_interface_nccl->iso_c_binding module~dtfft_interface_nvshmem->iso_fortran_env module~dtfft_interface_nvshmem->module~dtfft_parameters module~dtfft_interface_nvshmem->module~dtfft_utils module~dtfft_interface_nvshmem->iso_c_binding module~dtfft_nvrtc_kernel->iso_fortran_env module~dtfft_nvrtc_kernel->module~dtfft_interface_nvtx module~dtfft_nvrtc_kernel->module~dtfft_parameters module~dtfft_nvrtc_kernel->module~dtfft_utils module~dtfft_nvrtc_kernel->mpi_f08 module~dtfft_nvrtc_kernel->iso_c_binding module~dtfft_nvrtc_kernel->module~dtfft_interface_cuda_runtime 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_cuda->iso_fortran_env module~dtfft_interface_cuda->module~dtfft_parameters module~dtfft_interface_cuda->module~dtfft_utils module~dtfft_interface_cuda->iso_c_binding module~dtfft_interface_cuda->module~dtfft_interface_cuda_runtime module~dtfft_interface_nvrtc->iso_fortran_env module~dtfft_interface_nvrtc->module~dtfft_parameters module~dtfft_interface_nvrtc->module~dtfft_utils module~dtfft_interface_nvrtc->iso_c_binding module~dtfft_interface_nvrtc->module~dtfft_interface_cuda_runtime

Used by

  • module~~dtfft_transpose_plan_host~~UsedByGraph module~dtfft_transpose_plan_host dtfft_transpose_plan_host module~dtfft_plan dtfft_plan module~dtfft_plan->module~dtfft_transpose_plan_host 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=int8), private, save :: FORWARD_PLAN_IDS(3)
integer(kind=int8), private, save :: BACKWARD_PLAN_IDS(3)

Derived Types

type, public, extends(abstract_transpose_plan) ::  transpose_plan_host

Host transpose plan

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

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

Executes transposition

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

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

Frees memory allocated with mem_alloc

procedure, public :: create_private
procedure, public :: execute_private
procedure, public :: destroy
procedure, private, nopass :: get_plan_execution_time
procedure, private, pass(self) :: autotune_transpose_id
procedure, private, pass(self) :: autotune_mpi_datatypes
procedure, private, pass(self) :: autotune_grid_decomposition
procedure, private, pass(self) :: autotune_grid

Functions

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

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

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


Subroutines

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

private subroutine destroy(self)

Destroys transposition plans

Arguments

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

Transposition class

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

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)

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