dtfft_pencil Module

This module describes private pencil and public dtfft_pencil_t classes


Uses

  • module~~dtfft_pencil~~UsesGraph module~dtfft_pencil dtfft_pencil iso_c_binding iso_c_binding module~dtfft_pencil->iso_c_binding iso_fortran_env iso_fortran_env module~dtfft_pencil->iso_fortran_env module~dtfft_errors dtfft_errors module~dtfft_pencil->module~dtfft_errors module~dtfft_interface_cuda_runtime dtfft_interface_cuda_runtime module~dtfft_pencil->module~dtfft_interface_cuda_runtime module~dtfft_parameters dtfft_parameters module~dtfft_pencil->module~dtfft_parameters module~dtfft_utils dtfft_utils module~dtfft_pencil->module~dtfft_utils mpi_f08 mpi_f08 module~dtfft_pencil->mpi_f08 module~dtfft_errors->iso_fortran_env 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_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_errors module~dtfft_utils->module~dtfft_parameters module~dtfft_utils->mpi_f08

Used by

  • module~~dtfft_pencil~~UsedByGraph module~dtfft_pencil dtfft_pencil module~dtfft dtfft module~dtfft->module~dtfft_pencil module~dtfft_plan dtfft_plan module~dtfft->module~dtfft_plan module~dtfft_abstract_backend dtfft_abstract_backend module~dtfft_abstract_backend->module~dtfft_pencil module~dtfft_abstract_executor dtfft_abstract_executor module~dtfft_abstract_executor->module~dtfft_pencil module~dtfft_abstract_transpose_plan dtfft_abstract_transpose_plan module~dtfft_abstract_transpose_plan->module~dtfft_pencil module~dtfft_abstract_transpose_plan->module~dtfft_abstract_backend module~dtfft_api dtfft_api module~dtfft_api->module~dtfft_pencil module~dtfft_api->module~dtfft_plan module~dtfft_backend_cufftmp_m dtfft_backend_cufftmp_m module~dtfft_backend_cufftmp_m->module~dtfft_pencil module~dtfft_backend_cufftmp_m->module~dtfft_abstract_backend module~dtfft_executor_fftw_m dtfft_executor_fftw_m module~dtfft_executor_fftw_m->module~dtfft_pencil module~dtfft_executor_fftw_m->module~dtfft_abstract_executor module~dtfft_plan->module~dtfft_pencil module~dtfft_plan->module~dtfft_abstract_executor module~dtfft_plan->module~dtfft_abstract_transpose_plan module~dtfft_plan->module~dtfft_executor_fftw_m module~dtfft_transpose_plan_cuda dtfft_transpose_plan_cuda 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_executor_cufft_m dtfft_executor_cufft_m module~dtfft_plan->module~dtfft_executor_cufft_m module~dtfft_executor_mkl_m dtfft_executor_mkl_m module~dtfft_plan->module~dtfft_executor_mkl_m module~dtfft_executor_vkfft_m dtfft_executor_vkfft_m module~dtfft_plan->module~dtfft_executor_vkfft_m module~dtfft_transpose_handle_cuda dtfft_transpose_handle_cuda module~dtfft_transpose_handle_cuda->module~dtfft_pencil module~dtfft_transpose_handle_cuda->module~dtfft_abstract_backend module~dtfft_transpose_handle_cuda->module~dtfft_backend_cufftmp_m module~dtfft_backend_mpi dtfft_backend_mpi module~dtfft_transpose_handle_cuda->module~dtfft_backend_mpi module~dtfft_backend_nccl_m dtfft_backend_nccl_m module~dtfft_transpose_handle_cuda->module~dtfft_backend_nccl_m module~dtfft_transpose_handle_host dtfft_transpose_handle_host module~dtfft_transpose_handle_host->module~dtfft_pencil module~dtfft_transpose_plan_cuda->module~dtfft_pencil 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_transpose_plan_host->module~dtfft_pencil module~dtfft_transpose_plan_host->module~dtfft_abstract_transpose_plan module~dtfft_transpose_plan_host->module~dtfft_transpose_handle_host module~dtfft_backend_mpi->module~dtfft_abstract_backend module~dtfft_backend_nccl_m->module~dtfft_abstract_backend module~dtfft_executor_cufft_m->module~dtfft_abstract_executor module~dtfft_executor_mkl_m->module~dtfft_abstract_executor module~dtfft_executor_vkfft_m->module~dtfft_abstract_executor

Interfaces

public interface dtfft_pencil_t

Type bound constuctor for dtfft_pencil_t

  • private function create_pencil_t(starts, counts)

    Creates pencil object, that can be used to create dtFFT plans

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: starts(:)

    Local starts, starting from 0 for both C and Fortran

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

    Local counts of data, in elements

    Return Value type(dtfft_pencil_t)


Derived Types

type, public ::  dtfft_pencil_t

Structure to hold pencil decomposition info

Components

Type Visibility Attributes Name Initial
integer(kind=int8), public :: dim

Aligned dimension id

integer(kind=int8), public :: ndims = 0

Number of dimensions

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

Local starts, starting from 0 for both C and Fortran

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

Local counts of data, in elements

integer(kind=int64), public :: size

Total number of elements in a pencil

logical, private :: is_created = .false.

Is pencil created

Constructor

Type bound constuctor for dtfft_pencil_t

private function create_pencil_t (starts, counts)

Creates pencil object, that can be used to create dtFFT plans

Finalizations Procedures

final :: destroy_pencil_t

Type-Bound Procedures

procedure, private, pass(self) :: destroy => destroy_pencil_t_private

type, public, bind(C) ::  dtfft_pencil_c

Structure to hold pencil decomposition info

Components

Type Visibility Attributes Name Initial
integer(kind=c_int8_t), public :: dim

Aligned dimension id

integer(kind=c_int8_t), public :: ndims

Number of dimensions

integer(kind=c_int32_t), public :: starts(3)

Local starts, starting from 0 for both C and Fortran

integer(kind=c_int32_t), public :: counts(3)

Local counts of data, in elements

integer(kind=c_size_t), public :: size

Total number of elements in a pencil

type, public ::  pencil

Class that describes information about data layout

Components

Type Visibility Attributes Name Initial
integer(kind=int8), public :: aligned_dim

Position of aligned dimension. For example: X pencil aligned_dim = 1, Z pencil aligned_dim = 3

integer(kind=int8), public :: rank

Rank of buffer: 2 or 3

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

Local starts, starting from 0 for both C and Fortran

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

Local counts of data, in elements

logical, public :: is_even

Is data evenly distributed across processes

Type-Bound Procedures

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

Creates pencil

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

Destroys pencil

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

Creates public object that users can use to create own FFT backends

type, public ::  pencil_init

Class that describes information about data layout

Read more…

Components

Type Visibility Attributes Name Initial
type(MPI_Comm), public, allocatable :: comms(:)

1D communicators for each dimension

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

Local starts

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

Local counts

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

Global dimensions of entire region

Type-Bound Procedures

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

Creates and validates pencil passed by user to plan constructors

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

Destroys pencil_init


Functions

public pure function get_transpose_type(send, recv) result(transpose_type)

Determines transpose ID based on pencils

Arguments

Type IntentOptional Attributes Name
type(pencil), intent(in) :: send

Send pencil

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

Receive pencil

Return Value type(dtfft_transpose_t)

Transpose ID

private function check_if_even(count, comm)

Checks if data is evenly distributed across processes

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: count

Local count

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

Grid communicator

Return Value logical

private function make_public(self)

Creates public object that users can use to create own FFT backends

Arguments

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

Pencil

Return Value type(dtfft_pencil_t)

private function create_pencil_t(starts, counts)

Creates pencil object, that can be used to create dtFFT plans

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: starts(:)

Local starts, starting from 0 for both C and Fortran

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

Local counts of data, in elements

Return Value type(dtfft_pencil_t)

private function create_pencil_init(self, pencil, comm) result(error_code)

Creates and validates pencil passed by user to plan constructors

Arguments

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

Internal pencil representation based on dtfft_pencil_t

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

Pencil passed by user to plan constructors

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

MPI Communicator passed to plan constructors

Return Value integer(kind=int32)

Error code

private pure function check_overlap(lbounds1, sizes1, lbounds2, sizes2, ndims)

Check if two pencols overlap in ndims-dimensional space

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: lbounds1(:)

Lower bounds of first pencil

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

Sizes of first pencil

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

Lower bounds of second pencil

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

Sizes of second pencil

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

Number of dimensions

Return Value logical

private function check_continuity(all_lbounds, all_sizes, global_dims, comm_size)

Check if the local pencils cover the global space without gaps

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: all_lbounds(:,:)

Lower bounds of local pencils for each process

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

Sizes of local pencils for each process

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

Global dimensions of the problem

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

Number of processes in the communicator

Return Value logical

private function get_varying_dim(fixed_dims, total_dims) result(varying_dim)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: fixed_dims(:)
integer(kind=int32), intent(in) :: total_dims

Return Value integer(kind=int32)


Subroutines

public subroutine pencil_f2c(pencil, c_pencil)

Converts Fortran pencil to C pencil

Arguments

Type IntentOptional Attributes Name
type(dtfft_pencil_t), intent(in) :: pencil

Fortran pencil

type(dtfft_pencil_c), intent(out) :: c_pencil

C pencil

public subroutine pencil_c2f(c_pencil, pencil)

Converts C pencil to Fortran pencil

Arguments

Type IntentOptional Attributes Name
type(dtfft_pencil_c), intent(in) :: c_pencil

C pencil

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

Fortran pencil

public subroutine get_local_sizes(pencils, in_starts, in_counts, out_starts, out_counts, alloc_size)

Obtain local starts and counts in real and fourier spaces

Arguments

Type IntentOptional Attributes Name
type(pencil), intent(in) :: pencils(:)

Array of pencils

integer(kind=int32), intent(out), optional :: in_starts(:)

Start indexes in real space (0-based)

integer(kind=int32), intent(out), optional :: in_counts(:)

Number of elements in real space

integer(kind=int32), intent(out), optional :: out_starts(:)

Start indexes in fourier space (0-based)

integer(kind=int32), intent(out), optional :: out_counts(:)

Number of elements in fourier space

integer(kind=int64), intent(out), optional :: alloc_size

Minimal number of elements required to execute plan

private subroutine create(self, rank, aligned_dim, counts, comms, lstarts, lcounts)

Creates pencil

Arguments

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

Pencil

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

Rank of buffer

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

Position of aligned dimension

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

Global counts

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

Grid communicators

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

Local starts

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

Local counts

private subroutine destroy(self)

Destroys pencil

Arguments

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

Pencil

private subroutine get_local_size(n_global, comm, start, count, start_to_keep, size_to_keep)

Computes local portions of data based on global count and position inside grid communicator

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: n_global

Global number of points

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

Grid communicator

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

Local start

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

Local count

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

Start to keep in case of user defined decomposition

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

Size to keep in case of user defined decomposition

private subroutine destroy_pencil_t_private(self)

Destroys pencil

Arguments

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

Public pencil

private subroutine destroy_pencil_t(self)

Destroys pencil

Arguments

Type IntentOptional Attributes Name
type(dtfft_pencil_t), intent(inout) :: self

Public pencil

private subroutine destroy_pencil_init(self)

Destroys pencil_init

Arguments

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

Internal pencil representation based on dtfft_pencil_t

private subroutine sort_by_varying_dim(ranks, coords)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: ranks(:)
integer(kind=int32), intent(in) :: coords(:)

private subroutine create_1d_comm(lbounds, all_lbounds, fixed_dims, comm, new_comm)

Creates a new 1D communicator based on the fixed dimensions of the current pencil

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: lbounds(:)

Local starts of the current pencil

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

Local starts of all processes

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

Indices of fixed coordinates

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

Original MPI communicator

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

New 1D MPI communicator