module kinds_modTypes:
private type partition1d_trySubroutines 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)
Two-stage algorithm:
Preprocessor Options:
Author: Matthias Lieber
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_tryComponents:
maxload | max process load |
sumload | total load partitioned so far |
curload | load of current process |
pos | position in block list (weights) |
rank | current process |
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_rebalanceParameters:
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 |
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_migrationReturn the migration costs in given partition
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_maxloadReturn the maxiumum load in given partition