Module fd4_comm_mod


Uses:
    module fd4_globaldef_mod
    module fd4_vartab_mod
    module fd4_block_mod
    module fd4_mpi_mod
Variables:
    integer (kind=i_k), public :: comm_count = 0
    integer (kind=i8k), public :: comm_total_size
    integer (kind=MPI_ADDRESS_KIND), private, allocatable, dimension (:) :: displ
    integer, private, allocatable, dimension (:) :: blens
    integer, private, allocatable, dimension (:) :: types
Subroutines and functions:
    public subroutine fd4_comm_build_type (b, bl_type, err, addr)
    public subroutine fd4_comm_build_array_type (ext, stride, sbnd, sdata_type, err)
    private subroutine fd4_comm_alloc_helpers (len)

Block transfer between processes via MPI.

Preprocessor options:

TODO:

Author: Matthias Lieber

See also: module fd4_block


Description of Subroutines and Functions

fd4_comm_build_type

public subroutine fd4_comm_build_type (b, bl_type, err, addr)
    type (fd4_block), pointer :: b
    integer, intent(out) :: bl_type
    integer (kind=i_k), intent(out) :: err
    integer (kind=MPI_ADDRESS_KIND), optional, intent(out) :: addr
end subroutine fd4_comm_build_type
Parameters:
b the block
bl_type the MPI datatype for the block
err error status: 0...ok
addr optionally return the base address of this type as returned by MPI_Get_address
Routine to build the MPI datatype for a block.

Build an MPI datatype for the fd4_block components:


fd4_comm_build_array_type

public subroutine fd4_comm_build_array_type (ext, stride, sbnd, sdata_type, err)
    integer (kind=i_k), intent(in), dimension (0:3) :: ext
    integer (kind=i_k), intent(in), dimension (:,:) :: stride
    integer (kind=i_k), intent(in), dimension (3,2) :: sbnd
    integer, intent(out) :: sdata_type
    integer (kind=i_k), intent(out) :: err
end subroutine fd4_comm_build_array_type
Parameters:
ext extents of the sdata array
stride stride to select subsets of the array for the datatype
sbnd bounds to select a spatial subset
sdata_type the MPI datatype for the array
err error status: 0...ok
Build an MPI datatype for a single 4D array using a stride on the 1st and a subset of the other three dimensions.

The stride on 1st dimension is defined with stride, e.g.:

  
    stride(1,1:2) = (/ 1,2 /)   ! start end end index of one contiguous subsection
    stride(2,1:2) = (/ 4,4 /)
    stride(3,1:2) = (/ 7,9 /)
 
selects the following values from dimension 0 of the array, assuming size 9:
 
    123456789
    xx x  xxx
 

The implementation uses MPI_Type_create_subarray (MPI-2) unless FD4_NO_MPI_TYPE_CREATE_SUBARRAY is set. The resulting data type is not commited!


fd4_comm_alloc_helpers

private subroutine fd4_comm_alloc_helpers (len)
    integer, intent(in) :: len
end subroutine fd4_comm_alloc_helpers
Allocate module variables blens, types, displ.

Internal routine.