module fd4_globaldef_mod module fd4_domain_mod module fd4_iter_mod module fd4_part_1d_mod module fd4_mpi_mod module hilbert_mod module hilbert2d_mod module morton_mod module morton2d_mod module mrgrnk_mod module stack_mod module stack3_mod module rbtree_fd4_block_mod module timing_modTypes:
private type part_sfc_iterVariables:
integer (kind=i_k), public, parameter :: FD4_PART_SFC_SIMPLE = 1 integer (kind=i_k), public, parameter :: FD4_PART_SFC_BINSRCH = 2 integer (kind=i_k), public, parameter :: FD4_PART_SFC_PARALLEL = 4 integer (kind=i_k), public, parameter :: FD4_PART_SFC_SIMPLE2 = 8 integer (kind=i_k), public, parameter :: FD4_PART_SFC_HILBERT = 128 integer (kind=i_k), public, parameter :: FD4_PART_SFC_MORTON = 256Subroutines and functions:
public subroutine fd4_part_sfc_weight2 (domain, local_blocks, method, sfctype, balance, err, opt_binsteps, opt_accuracy, opt_blkmap_update) public pure subroutine fd4_part_sfc_find_partition (partition, idx, rank) public subroutine fd4_part_sfc_weight (domain, all_blocks, all_blocks_len, local_blocks, method, sfctype, balance, err, opt_blocks_changed, opt_binsteps, opt_accuracy) private subroutine fd4_part_sfc_exch_weights (domain, err, opt_localweights, opt_set_blkweights) public subroutine fd4_part_sfc_noweight (domain, all_blocks, all_blocks_len, local_blocks, sfctype, add_only, opt_blocks_changed) public subroutine fd4_part_sfc_update_blkmap_bnd (domain, bbnd, err) public subroutine fd4_part_sfc_update_blkmap (domain) private subroutine fd4_part_sfc_blkmap_boundary (domain) private pure subroutine fd4_part_sfc_c2i (domain, sfctype, pos, idx) private pure subroutine fd4_part_sfc_c2i_qsz (domain, sfctype, pos, idx) private pure subroutine fd4_part_sfc_i2c_qsz (domain, sfctype, idx, pos) private pure subroutine fd4_part_sfc_iter_init (iter, domain, sfctype) private pure subroutine fd4_part_sfc_iter_set (iter, idx) private pure subroutine fd4_part_sfc_iter_next (iter)
Author: Matthias Lieber
See also: module hilbert_mod, module fd4_part_1d_mod, module fd4_domain_mod
private type part_sfc_iter integer (kind=i_k), dimension (3) :: p = -1 integer (kind=i_k) :: idx = -1 integer (kind=i_k) :: sfctype = -1 integer (kind=i_k), dimension (2) :: map2d = 1 type (hilbert_iter) :: hiter type (hilbert2d_iter) :: h2diter type (morton_iter) :: miter type (morton2d_iter) :: m2diter end type part_sfc_itergeneral iterator over SFC
public subroutine fd4_part_sfc_weight2 (domain, local_blocks, method, sfctype, balance, err, opt_binsteps, opt_accuracy, opt_blkmap_update) type (fd4_domain), intent(inout) :: domain type (stack3), intent(inout) :: local_blocks integer (kind=i_k), intent(in) :: method integer (kind=i_k), intent(in) :: sfctype real (kind=r4k), intent(out) :: balance integer (kind=i_k), intent(out) :: err integer (kind=i_k), optional, intent(in) :: opt_binsteps real (kind=r8k), optional, intent(in) :: opt_accuracy logical, optional, intent(in) :: opt_blkmap_update end subroutine fd4_part_sfc_weight2Parameters:
domain | the domain |
local_blocks | stack3 of new local partition (differs from rank to rank) |
method | 1D partitioning method to use |
sfctype | space-filling curve to use |
balance | estimated balance of new partitioning |
err | error status: 0...ok |
opt_binsteps | max. number of steps for binary search methods, default: 100 |
opt_accuracy | target ratio from best possible load balance for binary steps estimation, must be <= 1.0, default: 0.99 |
opt_blkmap_update | update the full block map, default: true |
This version only works in non-adaptive block mode and when the SFC type is never changed.
Optimizations in comparison to fd4_part_sfc_weight:
public pure subroutine fd4_part_sfc_find_partition (partition, idx, rank) integer (kind=i_k), intent(in), dimension (0:) :: partition integer (kind=i_k), intent(in) :: idx integer (kind=i_k), intent(out) :: rank end subroutine fd4_part_sfc_find_partitionParameters:
partition | partition vector |
idx | block index |
rank | rank |
public subroutine fd4_part_sfc_weight (domain, all_blocks, all_blocks_len, local_blocks, method, sfctype, balance, err, opt_blocks_changed, opt_binsteps, opt_accuracy) type (fd4_domain), intent(inout) :: domain integer (kind=i_k), pointer, dimension (:,:) :: all_blocks integer (kind=i_k), intent(in) :: all_blocks_len type (stack3), intent(inout) :: local_blocks integer (kind=i_k), intent(in) :: method integer (kind=i_k), intent(in) :: sfctype real (kind=r4k), intent(out) :: balance integer (kind=i_k), intent(out) :: err logical, optional, intent(in) :: opt_blocks_changed integer (kind=i_k), optional, intent(in) :: opt_binsteps real (kind=r8k), optional, intent(in) :: opt_accuracy end subroutine fd4_part_sfc_weightParameters:
domain | the domain |
all_blocks | array of positions of the blocks in the new partion |
all_blocks_len | length of all_blocks(3,:) |
local_blocks | stack3 of new local partition (differs from rank to rank) |
method | 1D partitioning method to use |
sfctype | space-filling curve to use |
balance | estimated balance of new partitioning |
err | error status: 0...ok |
opt_blocks_changed | tell me if the blocks have changed (created/removed) |
opt_binsteps | max. number of steps for binary search methods, default: 100 |
opt_accuracy | target ratio from best possible load balance for binary steps estimation, must be <= 1.0, default: 0.99 |
In adaptive block mode all_blocks may be NULL() and all_blocks_len is ignored.
If opt_blocks_changed is present and is set to false: fd4_part_sfc_weight reuses the hilbert indexes and the ranking of blocks by the hilbert index from the last call!
private subroutine fd4_part_sfc_exch_weights (domain, err, opt_localweights, opt_set_blkweights) type (fd4_domain), intent(inout), target :: domain integer (kind=i_k), intent(out) :: err real (kind=r4k), optional, intent(in), dimension (:) :: opt_localweights logical, optional, intent(in) :: opt_set_blkweights end subroutine fd4_part_sfc_exch_weightsParameters:
domain | the domain |
err | error status: 0...ok |
opt_localweights | optional array of local block weights |
opt_set_blkweights | set domain%blkweights? default: yes, if allocated |
Updates domain%balance%blkweights.
Internal routine.
public subroutine fd4_part_sfc_noweight (domain, all_blocks, all_blocks_len, local_blocks, sfctype, add_only, opt_blocks_changed) type (fd4_domain), intent(inout) :: domain integer (kind=i_k), intent(in), dimension (:,:) :: all_blocks integer (kind=i_k), intent(in) :: all_blocks_len type (stack3), intent(inout) :: local_blocks integer (kind=i_k), intent(in) :: sfctype logical, optional, intent(in) :: add_only logical, optional, intent(in) :: opt_blocks_changed end subroutine fd4_part_sfc_noweightParameters:
domain | the domain |
all_blocks | array of positions of the blocks in the new partion |
all_blocks_len | length of all_blocks(3,:) |
local_blocks | stack3 of new local partition (differs from rank to rank) |
sfctype | space-filling curve to use |
add_only | only add new blocks, but don't touch existing blocks |
opt_blocks_changed | tell me if the blocks have changed (created/removed) |
The special option add_only effects:
public subroutine fd4_part_sfc_update_blkmap_bnd (domain, bbnd, err) type (fd4_domain), intent(inout) :: domain integer (kind=i_k), intent(in), dimension (3,2) :: bbnd integer (kind=i_k), intent(out) :: err end subroutine fd4_part_sfc_update_blkmap_bndParameters:
domain | the domain |
bbnd | bounds in block map |
err | error status: 0...ok (only L3 checking) |
public subroutine fd4_part_sfc_update_blkmap (domain) type (fd4_domain), intent(inout) :: domain end subroutine fd4_part_sfc_update_blkmapParameters:
domain | the domain |
private subroutine fd4_part_sfc_blkmap_boundary (domain) type (fd4_domain), intent(inout) :: domain end subroutine fd4_part_sfc_blkmap_boundaryParameters:
domain | the domain |
Internal routine.
private pure subroutine fd4_part_sfc_c2i (domain, sfctype, pos, idx) type (fd4_domain), intent(in) :: domain integer (kind=i_k), intent(in) :: sfctype integer (kind=i_k), intent(in), dimension (3) :: pos integer (kind=i_k), intent(out) :: idx end subroutine fd4_part_sfc_c2iParameters:
domain | the domain |
sfctype | space-filling curve to use |
pos | block position |
idx | index on SFC |
The index is not contiguous over the exact size of the domain. i.e. max(idx) == 3 ** (2**domain%sfclevel) (3D case)
Internal routine.
private pure subroutine fd4_part_sfc_c2i_qsz (domain, sfctype, pos, idx) type (fd4_domain), intent(in) :: domain integer (kind=i_k), intent(in) :: sfctype integer (kind=i_k), intent(in), dimension (3) :: pos integer (kind=i_k), intent(out) :: idx end subroutine fd4_part_sfc_c2i_qszParameters:
domain | the domain |
sfctype | space-filling curve to use |
pos | block position |
idx | index on SFC |
The index is contiguous over the exact size of the domain. i.e. max(idx) == PRODUCT(domain%blnum).
Internal routine.
private pure subroutine fd4_part_sfc_i2c_qsz (domain, sfctype, idx, pos) type (fd4_domain), intent(in) :: domain integer (kind=i_k), intent(in) :: sfctype integer (kind=i_k), intent(in) :: idx integer (kind=i_k), intent(out), dimension (3) :: pos end subroutine fd4_part_sfc_i2c_qszParameters:
domain | the domain |
sfctype | space-filling curve to use |
idx | index on SFC |
pos | block position |
The index is contiguous over the exact size of the domain, i.e. max(idx) == PRODUCT(domain%blnum).
Internal routine.
private pure subroutine fd4_part_sfc_iter_init (iter, domain, sfctype) type (part_sfc_iter), intent(inout), target :: iter type (fd4_domain), intent(in) :: domain integer (kind=i_k), intent(in) :: sfctype end subroutine fd4_part_sfc_iter_initParameters:
iter | SFC iterator |
domain | the domain |
sfctype | space-filling curve to use |
Internal routine.
private pure subroutine fd4_part_sfc_iter_set (iter, idx) type (part_sfc_iter), intent(inout), target :: iter integer (kind=i_k), intent(in) :: idx end subroutine fd4_part_sfc_iter_setParameters:
iter | SFC iterator |
idx | SFC index to set |
Internal routine.
private pure subroutine fd4_part_sfc_iter_next (iter) type (part_sfc_iter), intent(inout), target :: iter end subroutine fd4_part_sfc_iter_nextParameters:
iter | SFC iterator |
Internal routine.