Module partition1d_mod


Uses:
    module kinds_mod
Types:
    private type partition1d_try
Subroutines and functions:
    public subroutine partition1d_rebalance (nblocks, nprocs, maxtries, weights, blkmap, lb_tolerance, mi_tolerance, partition)
    private integer (kind=i_k) function get_migration (blkmap, partition)
    private real (kind=r4k) function get_maxload (weights, partition)

1D dynamic load balancing. Intented to be used in combination with SFC load balancing.

Two-stage algorithm:

The algorithm is completely serial.

Preprocessor Options:

TODO/IDEAS:

Author: Matthias Lieber


Description of Types

partition1d_try

private type partition1d_try
    real (kind=r4k) :: maxload = 0.0
    real (kind=r4k) :: sumload = 0.0
    real (kind=r4k) :: curload = 0.0
    integer (kind=i_k) :: pos = 1
    integer (kind=i_k) :: rank = 0
end type partition1d_try
Components:
maxload max process load
sumload total load partitioned so far
curload load of current process
pos position in block list (weights)
rank current process
Type for one partition try

Description of Subroutines and Functions

partition1d_rebalance

public subroutine partition1d_rebalance (nblocks, nprocs, maxtries, weights, blkmap, lb_tolerance, mi_tolerance, partition)
    integer (kind=i_k), intent(in) :: nblocks
    integer (kind=i_k), intent(in) :: nprocs
    integer (kind=i_k), intent(in) :: maxtries
    real (kind=r4k), intent(in), dimension (nblocks) :: weights
    integer (kind=i_k), intent(in), dimension (nblocks) :: blkmap
    real (kind=r4k), intent(in) :: lb_tolerance
    real (kind=r4k), intent(in) :: mi_tolerance
    integer (kind=i_k), intent(out), dimension (0:nprocs) :: partition
end subroutine partition1d_rebalance
Parameters:
nblocks number of blocks
nprocs number of processes
maxtries max. number of different partitions to try out
weights block weights, must be >0
blkmap map of current block owners (-1 for unassigned blocks)
lb_tolerance tolerance for premature exit of loop (0 means none)
mi_tolerance tolerance for decreasing balance when optimizing migration
partition output partition vector, contains start indices of partitions
1D dynamic load balancing routine. The vector of block weights is devided in nprocs nearly equal-weighted, consecutive partitions.


get_migration

private integer (kind=i_k) function get_migration (blkmap, partition)
    integer (kind=i_k), intent(in), dimension (:) :: blkmap
    integer (kind=i_k), intent(in), dimension (:) :: partition
end function get_migration
Return the migration costs in given partition

get_maxload

private real (kind=r4k) function get_maxload (weights, partition)
    real (kind=r4k), intent(in), dimension (:) :: weights
    integer (kind=i_k), intent(in), dimension (:) :: partition
end function get_maxload
Return the maxiumum load in given partition