Module fd4_part_dir_mod


Uses:
    module fd4_globaldef_mod
    module fd4_mpi_mod
    module timing_mod
    module rbtree_int_mod
    module stack_mod
Types:
    public type fd4_part_dir
Variables:
    logical, private, parameter :: less_msgs = .true.
    integer, private, parameter :: bufsize = 2050
    integer, private, parameter :: iHUGE = HUGE (bufsize)
    integer, private, parameter :: iFLAG1 = iHUGE
    integer, private, parameter :: iFLAG2 = iHUGE - 1
Subroutines and functions:
    public subroutine fd4_part_dir_init (partdir, mpi, nblocks)
    private subroutine fd4_part_dir_reset_stats (partdir)
    private subroutine fd4_part_dir_stats (partdir, msg_cnt, msg_size, long_msg_cnt)
    public subroutine fd4_part_dir_dump_stats (partdir)
    public subroutine fd4_part_dir_delete (partdir)
    public subroutine fd4_part_dir_put (partdir, mypartition, err)
    public subroutine fd4_part_dir_get (partdir, partition, partition_old, new_neighbors, err)
    private subroutine fd4_part_dir_fill_gaps (partdir, p, bnd, myotherpart, err)
    private subroutine fd4_part_dir_eat_msg (partdir, buf, partition, partition_old, bnd, bnd_old, bnd_neighs, estim, err)
    private subroutine fd4_part_dir_mkmsg_emptyparts (partdir, crank, c, buf)
    private subroutine fd4_part_dir_mkmsg (partdir, crank, c, buf)
    private integer (kind=i_k) pure function fd4_part_dir_b2r (partdir, idx)
    private integer (kind=i_k) pure function fd4_part_dir_r2bs (partdir, rank)
    private integer (kind=i_k) pure function fd4_part_dir_r2be (partdir, rank)

Distributed partition vector directory for 1D partitioning methods. Enables to avoid the replication of the partition vector on all ranks.

Uses MPI_Bsend but does not attach buffer.

preprocessor flags:

Author: Matthias Lieber


Description of Types

fd4_part_dir

public type fd4_part_dir
    integer (kind=i_k) :: now
    integer (kind=i_k) :: last
    type (rbtree_int), dimension (2) :: parts
    integer (kind=i_k), dimension (2) :: lb
    integer (kind=i_k), dimension (2) :: ub
    integer (kind=i_k) :: mylb
    integer (kind=i_k) :: myub
    type (fd4_mpi), pointer :: mpi => NULL ()
    integer (kind=i_k) :: nblocks = 0
    type (stack) :: buf
    type (stack) :: msg_to_myself
    integer (kind=i_k) :: part_lb_now
    integer (kind=i_k) :: part_ub_now
    integer (kind=i_k) :: part_lb_last
    integer (kind=i_k) :: part_ub_last
    integer (kind=i8k), dimension (4) :: stat_msg
    integer (kind=i8k) :: nblocks_i8 = 0
    integer (kind=i8k) :: nprocs_i8 = 0
    integer (kind=i8k) :: nprocs_minusone_i8 = 0
end type fd4_part_dir
Components:
parts stores two partiton vector subsets (now and last)
lb lower and upper bounds (rank) of partition vector subsets
ub lower and upper bounds (rank) of partition vector subsets
mylb lower and upper bound (block) of partition vector subset (fixed)
myub lower and upper bound (block) of partition vector subset (fixed)
part_lb_now lower and upper bound of region updated in partition vector by last get
part_ub_now lower and upper bound of region updated in partition vector by last get
part_lb_last lower and upper bound of region updated in partition vector by last get
part_ub_last lower and upper bound of region updated in partition vector by last get
nblocks_i8 for b2r / r2b
nprocs_i8 for b2r / r2b
nprocs_minusone_i8 for b2r / r2b

Description of Subroutines and Functions

fd4_part_dir_init

public subroutine fd4_part_dir_init (partdir, mpi, nblocks)
    type (fd4_part_dir), intent(inout) :: partdir
    type (fd4_mpi), intent(in), target :: mpi
    integer (kind=i_k), intent(in) :: nblocks
end subroutine fd4_part_dir_init
Parameters:
nblocks number of blocks

fd4_part_dir_reset_stats

private subroutine fd4_part_dir_reset_stats (partdir)
    type (fd4_part_dir), intent(inout) :: partdir
end subroutine fd4_part_dir_reset_stats

fd4_part_dir_stats

private subroutine fd4_part_dir_stats (partdir, msg_cnt, msg_size, long_msg_cnt)
    type (fd4_part_dir), intent(inout) :: partdir
    integer (kind=i_k), intent(in) :: msg_cnt
    integer (kind=i_k), intent(in) :: msg_size
    integer (kind=i_k), intent(in) :: long_msg_cnt
end subroutine fd4_part_dir_stats

fd4_part_dir_dump_stats

public subroutine fd4_part_dir_dump_stats (partdir)
    type (fd4_part_dir), intent(inout) :: partdir
end subroutine fd4_part_dir_dump_stats

fd4_part_dir_delete

public subroutine fd4_part_dir_delete (partdir)
    type (fd4_part_dir), intent(inout) :: partdir
end subroutine fd4_part_dir_delete

fd4_part_dir_put

public subroutine fd4_part_dir_put (partdir, mypartition, err)
    type (fd4_part_dir), intent(inout) :: partdir
    integer (kind=i_k), intent(in), dimension (2) :: mypartition
    integer, intent(out) :: err
end subroutine fd4_part_dir_put
Parameters:
mypartition partition vector subset for local partition
Put partition borders to directory.

fd4_part_dir_get

public subroutine fd4_part_dir_get (partdir, partition, partition_old, new_neighbors, err)
    type (fd4_part_dir), intent(inout) :: partdir
    integer (kind=i_k), intent(inout), dimension (0:) :: partition
    integer (kind=i_k), intent(inout), dimension (0:) :: partition_old
    logical, intent(in) :: new_neighbors
    integer, intent(out) :: err
end subroutine fd4_part_dir_get
Parameters:
partition partition vector
partition_old old partition vector
new_neighbors get all borders required to know neighbors on SFC? (e.g. in case of empty parts)
Get from directory.

partition and partition_old are not allowed to contain negative values and the own partition must be set in both partition vectors.


fd4_part_dir_fill_gaps

private subroutine fd4_part_dir_fill_gaps (partdir, p, bnd, myotherpart, err)
    type (fd4_part_dir), intent(in) :: partdir
    integer (kind=i_k), intent(inout), dimension (0:) :: p
    integer (kind=i_k), intent(in), dimension (2) :: bnd
    integer (kind=i_k), intent(in), dimension (2) :: myotherpart
    integer (kind=i_k), intent(out) :: err
end subroutine fd4_part_dir_fill_gaps
Parameters:
p partition vector
bnd min and max index in p that has been updated
myotherpart other partition (old vs. new)

fd4_part_dir_eat_msg

private subroutine fd4_part_dir_eat_msg (partdir, buf, partition, partition_old, bnd, bnd_old, bnd_neighs, estim, err)
    type (fd4_part_dir), intent(in) :: partdir
    type (stack), intent(in) :: buf
    integer (kind=i_k), intent(inout), dimension (0:) :: partition
    integer (kind=i_k), intent(inout), dimension (0:) :: partition_old
    integer (kind=i_k), intent(inout), dimension (2) :: bnd
    integer (kind=i_k), intent(inout), dimension (2) :: bnd_old
    integer (kind=i_k), intent(inout), dimension (2) :: bnd_neighs
    type (rbtree_int), intent(inout) :: estim
    integer (kind=i_k), intent(out) :: err
end subroutine fd4_part_dir_eat_msg
Parameters:
partition partition vector
partition_old old partition vector
bnd min and max index in partition that has been updated
bnd_old min and max index in partition_old that has been updated
bnd_neighs min and max index in partition that has been updated (neighbors)
estim stack of estimated borders (i.e. negative position in message)

fd4_part_dir_mkmsg_emptyparts

private subroutine fd4_part_dir_mkmsg_emptyparts (partdir, crank, c, buf)
    type (fd4_part_dir), intent(in) :: partdir
    integer (kind=i_k), intent(in) :: crank
    integer (kind=i_k), intent(in) :: c
    type (stack), intent(inout) :: buf
end subroutine fd4_part_dir_mkmsg_emptyparts

fd4_part_dir_mkmsg

private subroutine fd4_part_dir_mkmsg (partdir, crank, c, buf)
    type (fd4_part_dir), intent(in) :: partdir
    integer (kind=i_k), intent(in) :: crank
    integer (kind=i_k), intent(in) :: c
    type (stack), intent(inout) :: buf
end subroutine fd4_part_dir_mkmsg

fd4_part_dir_b2r

private integer (kind=i_k) pure function fd4_part_dir_b2r (partdir, idx)
    type (fd4_part_dir), intent(in) :: partdir
    integer (kind=i_k), intent(in) :: idx
end function fd4_part_dir_b2r

fd4_part_dir_r2bs

private integer (kind=i_k) pure function fd4_part_dir_r2bs (partdir, rank)
    type (fd4_part_dir), intent(in) :: partdir
    integer (kind=i_k), intent(in) :: rank
end function fd4_part_dir_r2bs

fd4_part_dir_r2be

private integer (kind=i_k) pure function fd4_part_dir_r2be (partdir, rank)
    type (fd4_part_dir), intent(in) :: partdir
    integer (kind=i_k), intent(in) :: rank
end function fd4_part_dir_r2be