(git:6a2e663)
|
DBT tensor framework for block-sparse tensor contraction: Types and create/destroy routines. More...
Functions/Subroutines | |
recursive subroutine, public | dbt_mp_dims_create (nodes, dims, tensor_dims, lb_ratio) |
Create process grid dimensions corresponding to one dimension of the matrix representation of a tensor, imposing that no process grid dimension is greater than the corresponding tensor dimension. More... | |
subroutine, public | dbt_pgrid_create_expert (mp_comm, dims, pgrid, map1_2d, map2_2d, tensor_dims, nsplit, dimsplit) |
Create an n-dimensional process grid. We can not use a n-dimensional MPI cartesian grid for tensors since the mapping between n-dim. and 2-dim. index allows for an arbitrary reordering of tensor index. Therefore we can not use n-dim. MPI Cartesian grid because it may not be consistent with the respective 2d grid. The 2d Cartesian MPI grid is the reference grid (since tensor data is stored as DBM matrix) and this routine creates an object that is a n-dim. interface to this grid. map1_2d and map2_2d don't need to be specified (correctly), grid may be redefined in dbt_distribution_new. Note that pgrid is equivalent to a MPI cartesian grid only if map1_2d and map2_2d don't reorder indices (which is the case if [map1_2d, map2_2d] == [1, 2, ..., ndims]). Otherwise the mapping of grid coordinates to processes depends on the ordering of the indices and is not equivalent to a MPI cartesian grid. More... | |
type(dbt_pgrid_type) function, public | dbt_nd_mp_comm (comm_2d, map1_2d, map2_2d, dims_nd, dims1_nd, dims2_nd, pdims_2d, tdims, nsplit, dimsplit) |
Create a default nd process topology that is consistent with a given 2d topology. Purpose: a nd tensor defined on the returned process grid can be represented as a DBM matrix with the given 2d topology. This is needed to enable contraction of 2 tensors (must have the same 2d process grid). More... | |
subroutine, public | dbt_nd_mp_free (mp_comm) |
Release the MPI communicator. More... | |
subroutine, public | mp_environ_pgrid (pgrid, dims, task_coor) |
as mp_environ but for special pgrid type More... | |
subroutine, public | dbt_distribution_new_expert (dist, pgrid, map1_2d, map2_2d, nd_dist_1, nd_dist_2, nd_dist_3, nd_dist_4, own_comm) |
Create a tensor distribution. More... | |
subroutine, public | dbt_distribution_new (dist, pgrid, nd_dist_1, nd_dist_2, nd_dist_3, nd_dist_4) |
Create a tensor distribution. More... | |
subroutine, public | dbt_pgrid_destroy (pgrid, keep_comm) |
destroy process grid More... | |
subroutine, public | dbt_distribution_destroy (dist) |
Destroy tensor distribution. More... | |
type(dbt_distribution_type) function, public | dbt_distribution (tensor) |
get distribution from tensor More... | |
subroutine, public | dbt_hold (tensor) |
reference counting for tensors (only needed for communicator handle that must be freed when no longer needed) More... | |
pure integer(int_8) function, public | ndims_matrix_row (tensor) |
how many tensor dimensions are mapped to matrix row More... | |
pure integer(int_8) function, public | ndims_matrix_column (tensor) |
how many tensor dimensions are mapped to matrix column More... | |
pure integer function, public | ndims_tensor (tensor) |
tensor rank More... | |
subroutine, public | dims_tensor (tensor, dims) |
tensor dimensions More... | |
subroutine, public | dbt_destroy (tensor) |
Destroy a tensor. More... | |
subroutine, public | blk_dims_tensor (tensor, dims) |
tensor block dimensions More... | |
subroutine, public | dbt_blk_sizes (tensor, ind, blk_size) |
Size of tensor block. More... | |
subroutine, public | dbt_blk_offsets (tensor, ind, blk_offset) |
offset of tensor block More... | |
subroutine, public | dbt_get_stored_coordinates (tensor, ind_nd, processor) |
Generalization of block_get_stored_coordinates for tensors. More... | |
subroutine, public | dbt_pgrid_create (mp_comm, dims, pgrid, tensor_dims) |
subroutine, public | dbt_pgrid_set_strict_split (pgrid) |
freeze current split factor such that it is never changed during contraction More... | |
subroutine, public | dbt_pgrid_change_dims (pgrid, pdims) |
change dimensions of an existing process grid. More... | |
subroutine, public | dbt_filter (tensor, eps) |
As block_filter. More... | |
pure integer function, public | dbt_nblks_local (tensor, idim) |
local number of blocks along dimension idim More... | |
pure integer function, public | dbt_nblks_total (tensor, idim) |
total numbers of blocks along dimension idim More... | |
subroutine, public | dbt_get_info (tensor, nblks_total, nfull_total, nblks_local, nfull_local, pdims, my_ploc, blks_local_1, blks_local_2, blks_local_3, blks_local_4, proc_dist_1, proc_dist_2, proc_dist_3, proc_dist_4, blk_size_1, blk_size_2, blk_size_3, blk_size_4, blk_offset_1, blk_offset_2, blk_offset_3, blk_offset_4, distribution, name) |
As block_get_info but for tensors. More... | |
pure integer function, public | dbt_get_num_blocks (tensor) |
As block_get_num_blocks: get number of local blocks. More... | |
integer(kind=int_8) function, public | dbt_get_num_blocks_total (tensor) |
Get total number of blocks. More... | |
subroutine, public | dbt_clear (tensor) |
Clear tensor (s.t. it does not contain any blocks) More... | |
subroutine, public | dbt_finalize (tensor) |
Finalize tensor, as block_finalize. This should be taken care of internally in DBT tensors, there should not be any need to call this routine outside of DBT tensors. More... | |
subroutine, public | dbt_scale (tensor, alpha) |
as block_scale More... | |
pure integer function, public | dbt_get_nze (tensor) |
integer(kind=int_8) function, public | dbt_get_nze_total (tensor) |
pure integer function, public | dbt_blk_size (tensor, ind, idim) |
block size of block with index ind along dimension idim More... | |
pure integer function, public | dbt_max_nblks_local (tensor) |
returns an estimate of maximum number of local blocks in tensor (irrespective of the actual number of currently present blocks) this estimate is based on the following assumption: tensor data is dense and load balancing is within a factor of 2 More... | |
subroutine, public | dbt_default_distvec (nblk, nproc, blk_size, dist) |
get a load-balanced and randomized distribution along one tensor dimension More... | |
subroutine, public | dbt_copy_contraction_storage (tensor_in, tensor_out) |
DBT tensor framework for block-sparse tensor contraction: Types and create/destroy routines.
recursive subroutine, public dbt_types::dbt_mp_dims_create | ( | integer, intent(in) | nodes, |
integer, dimension(:), intent(inout) | dims, | ||
integer, dimension(:), intent(in) | tensor_dims, | ||
real(dp), intent(in), optional | lb_ratio | ||
) |
Create process grid dimensions corresponding to one dimension of the matrix representation of a tensor, imposing that no process grid dimension is greater than the corresponding tensor dimension.
nodes | Total number of nodes available for this matrix dimension |
dims | process grid dimension corresponding to tensor_dims |
tensor_dims | tensor dimensions |
lb_ratio | load imbalance acceptance factor |
Definition at line 497 of file dbt_types.F.
subroutine, public dbt_types::dbt_pgrid_create_expert | ( | class(mp_comm_type), intent(in) | mp_comm, |
integer, dimension(:), intent(inout) | dims, | ||
type(dbt_pgrid_type), intent(out) | pgrid, | ||
integer, dimension(:), intent(in) | map1_2d, | ||
integer, dimension(:), intent(in) | map2_2d, | ||
integer, dimension(:), intent(in), optional | tensor_dims, | ||
integer, intent(in), optional | nsplit, | ||
integer, intent(in), optional | dimsplit | ||
) |
Create an n-dimensional process grid. We can not use a n-dimensional MPI cartesian grid for tensors since the mapping between n-dim. and 2-dim. index allows for an arbitrary reordering of tensor index. Therefore we can not use n-dim. MPI Cartesian grid because it may not be consistent with the respective 2d grid. The 2d Cartesian MPI grid is the reference grid (since tensor data is stored as DBM matrix) and this routine creates an object that is a n-dim. interface to this grid. map1_2d and map2_2d don't need to be specified (correctly), grid may be redefined in dbt_distribution_new. Note that pgrid is equivalent to a MPI cartesian grid only if map1_2d and map2_2d don't reorder indices (which is the case if [map1_2d, map2_2d] == [1, 2, ..., ndims]). Otherwise the mapping of grid coordinates to processes depends on the ordering of the indices and is not equivalent to a MPI cartesian grid.
mp_comm | simple MPI Communicator |
dims | grid dimensions - if entries are 0, dimensions are chosen automatically. |
pgrid | n-dimensional grid object |
map1_2d | which nd-indices map to first matrix index and in which order |
map2_2d | which nd-indices map to first matrix index and in which order |
tensor_dims | tensor block dimensions. If present, process grid dimensions are created such that good load balancing is ensured even if some of the tensor dimensions are small (i.e. on the same order or smaller than nproc**(1/ndim) where ndim is the tensor rank) |
nsplit | impose a constant split factor |
dimsplit | which matrix dimension to split |
Definition at line 593 of file dbt_types.F.
type(dbt_pgrid_type) function, public dbt_types::dbt_nd_mp_comm | ( | class(mp_comm_type), intent(in) | comm_2d, |
integer, dimension(:), intent(in) | map1_2d, | ||
integer, dimension(:), intent(in) | map2_2d, | ||
integer, dimension(size(map1_2d) + size(map2_2d)), intent(in), optional | dims_nd, | ||
integer, dimension(size(map1_2d)), intent(in), optional | dims1_nd, | ||
integer, dimension(size(map2_2d)), intent(in), optional | dims2_nd, | ||
integer, dimension(2), intent(in), optional | pdims_2d, | ||
integer, dimension(size(map1_2d) + size(map2_2d)), intent(in), optional | tdims, | ||
integer, intent(in), optional | nsplit, | ||
integer, intent(in), optional | dimsplit | ||
) |
Create a default nd process topology that is consistent with a given 2d topology. Purpose: a nd tensor defined on the returned process grid can be represented as a DBM matrix with the given 2d topology. This is needed to enable contraction of 2 tensors (must have the same 2d process grid).
comm_2d | communicator with 2-dimensional topology |
map1_2d | which nd-indices map to first matrix index and in which order |
map2_2d | which nd-indices map to second matrix index and in which order |
dims_nd | nd dimensions |
pdims_2d | if comm_2d does not have a cartesian topology associated, can input dimensions with pdims_2d |
tdims | tensor block dimensions. If present, process grid dimensions are created such that good load balancing is ensured even if some of the tensor dimensions are small (i.e. on the same order or smaller than nproc**(1/ndim) where ndim is the tensor rank) |
Definition at line 651 of file dbt_types.F.
subroutine, public dbt_types::dbt_nd_mp_free | ( | type(mp_comm_type), intent(inout) | mp_comm | ) |
Release the MPI communicator.
Definition at line 732 of file dbt_types.F.
subroutine, public dbt_types::mp_environ_pgrid | ( | type(dbt_pgrid_type), intent(in) | pgrid, |
integer, dimension(ndims_mapping(pgrid%nd_index_grid)), intent(out) | dims, | ||
integer, dimension(ndims_mapping(pgrid%nd_index_grid)), intent(out) | task_coor | ||
) |
as mp_environ but for special pgrid type
Definition at line 767 of file dbt_types.F.
subroutine, public dbt_types::dbt_distribution_new_expert | ( | type(dbt_distribution_type), intent(out) | dist, |
type(dbt_pgrid_type), intent(in) | pgrid, | ||
integer, dimension(:), intent(in) | map1_2d, | ||
integer, dimension(:), intent(in) | map2_2d, | ||
integer, dimension(:), intent(in), optional | nd_dist_1, | ||
integer, dimension(:), intent(in), optional | nd_dist_2, | ||
integer, dimension(:), intent(in), optional | nd_dist_3, | ||
integer, dimension(:), intent(in), optional | nd_dist_4, | ||
logical, intent(in), optional | own_comm | ||
) |
Create a tensor distribution.
pgrid | process grid |
map1_2d | which nd-indices map to first matrix index and in which order |
map2_2d | which nd-indices map to second matrix index and in which order |
own_comm | whether distribution should own communicator |
Definition at line 786 of file dbt_types.F.
subroutine, public dbt_types::dbt_distribution_new | ( | type(dbt_distribution_type), intent(out) | dist, |
type(dbt_pgrid_type), intent(in) | pgrid, | ||
integer, dimension(:), intent(in), optional | nd_dist_1, | ||
integer, dimension(:), intent(in), optional | nd_dist_2, | ||
integer, dimension(:), intent(in), optional | nd_dist_3, | ||
integer, dimension(:), intent(in), optional | nd_dist_4 | ||
) |
Create a tensor distribution.
pgrid | process grid |
nd_dist_i | distribution vectors for all tensor dimensions |
Definition at line 885 of file dbt_types.F.
subroutine, public dbt_types::dbt_pgrid_destroy | ( | type(dbt_pgrid_type), intent(inout) | pgrid, |
logical, intent(in), optional | keep_comm | ||
) |
destroy process grid
keep_comm | if .TRUE. communicator is not freed |
Definition at line 904 of file dbt_types.F.
subroutine, public dbt_types::dbt_distribution_destroy | ( | type(dbt_distribution_type), intent(inout) | dist | ) |
Destroy tensor distribution.
Definition at line 925 of file dbt_types.F.
type(dbt_distribution_type) function, public dbt_types::dbt_distribution | ( | type(dbt_type), intent(in) | tensor | ) |
get distribution from tensor
Definition at line 979 of file dbt_types.F.
subroutine, public dbt_types::dbt_hold | ( | type(dbt_type), intent(in) | tensor | ) |
reference counting for tensors (only needed for communicator handle that must be freed when no longer needed)
Definition at line 1187 of file dbt_types.F.
pure integer(int_8) function, public dbt_types::ndims_matrix_row | ( | type(dbt_type), intent(in) | tensor | ) |
how many tensor dimensions are mapped to matrix row
Definition at line 1203 of file dbt_types.F.
pure integer(int_8) function, public dbt_types::ndims_matrix_column | ( | type(dbt_type), intent(in) | tensor | ) |
how many tensor dimensions are mapped to matrix column
Definition at line 1215 of file dbt_types.F.
pure integer function, public dbt_types::ndims_tensor | ( | type(dbt_type), intent(in) | tensor | ) |
tensor rank
Definition at line 1226 of file dbt_types.F.
subroutine, public dbt_types::dims_tensor | ( | type(dbt_type), intent(in) | tensor, |
integer, dimension(ndims_tensor(tensor)), intent(out) | dims | ||
) |
tensor dimensions
Definition at line 1237 of file dbt_types.F.
subroutine, public dbt_types::dbt_destroy | ( | type(dbt_type), intent(inout) | tensor | ) |
Destroy a tensor.
Definition at line 1409 of file dbt_types.F.
subroutine, public dbt_types::blk_dims_tensor | ( | type(dbt_type), intent(in) | tensor, |
integer, dimension(ndims_tensor(tensor)), intent(out) | dims | ||
) |
tensor block dimensions
Definition at line 1465 of file dbt_types.F.
subroutine, public dbt_types::dbt_blk_sizes | ( | type(dbt_type), intent(in) | tensor, |
integer, dimension(ndims_tensor(tensor)), intent(in) | ind, | ||
integer, dimension(ndims_tensor(tensor)), intent(out) | blk_size | ||
) |
Size of tensor block.
Definition at line 1478 of file dbt_types.F.
subroutine, public dbt_types::dbt_blk_offsets | ( | type(dbt_type), intent(in) | tensor, |
integer, dimension(ndims_tensor(tensor)), intent(in) | ind, | ||
integer, dimension(ndims_tensor(tensor)), intent(out) | blk_offset | ||
) |
offset of tensor block
ind | block index |
blk_offset | block offset |
Definition at line 1494 of file dbt_types.F.
subroutine, public dbt_types::dbt_get_stored_coordinates | ( | type(dbt_type), intent(in) | tensor, |
integer, dimension(ndims_tensor(tensor)), intent(in) | ind_nd, | ||
integer, intent(out) | processor | ||
) |
Generalization of block_get_stored_coordinates for tensors.
Definition at line 1509 of file dbt_types.F.
subroutine, public dbt_types::dbt_pgrid_create | ( | class(mp_comm_type), intent(in) | mp_comm, |
integer, dimension(:), intent(inout) | dims, | ||
type(dbt_pgrid_type), intent(out) | pgrid, | ||
integer, dimension(:), intent(in), optional | tensor_dims | ||
) |
Definition at line 1524 of file dbt_types.F.
subroutine, public dbt_types::dbt_pgrid_set_strict_split | ( | type(dbt_pgrid_type), intent(inout) | pgrid | ) |
freeze current split factor such that it is never changed during contraction
Definition at line 1547 of file dbt_types.F.
subroutine, public dbt_types::dbt_pgrid_change_dims | ( | type(dbt_pgrid_type), intent(inout) | pgrid, |
integer, dimension(:), intent(inout) | pdims | ||
) |
change dimensions of an existing process grid.
pgrid | process grid to be changed |
pdims | new process grid dimensions, should all be set > 0 |
Definition at line 1558 of file dbt_types.F.
subroutine, public dbt_types::dbt_filter | ( | type(dbt_type), intent(inout) | tensor, |
real(dp), intent(in) | eps | ||
) |
As block_filter.
Definition at line 1587 of file dbt_types.F.
pure integer function, public dbt_types::dbt_nblks_local | ( | type(dbt_type), intent(in) | tensor, |
integer, intent(in) | idim | ||
) |
local number of blocks along dimension idim
Definition at line 1599 of file dbt_types.F.
pure integer function, public dbt_types::dbt_nblks_total | ( | type(dbt_type), intent(in) | tensor, |
integer, intent(in) | idim | ||
) |
total numbers of blocks along dimension idim
Definition at line 1616 of file dbt_types.F.
subroutine, public dbt_types::dbt_get_info | ( | type(dbt_type), intent(in) | tensor, |
integer, dimension(ndims_tensor(tensor)), intent(out), optional | nblks_total, | ||
integer, dimension(ndims_tensor(tensor)), intent(out), optional | nfull_total, | ||
integer, dimension(ndims_tensor(tensor)), intent(out), optional | nblks_local, | ||
integer, dimension(ndims_tensor(tensor)), intent(out), optional | nfull_local, | ||
integer, dimension(ndims_tensor(tensor)), intent(out), optional | pdims, | ||
integer, dimension(ndims_tensor(tensor)), intent(out), optional | my_ploc, | ||
integer, dimension(dbt_nblks_local(tensor, 1)), intent(out), optional | blks_local_1, | ||
integer, dimension(dbt_nblks_local(tensor, 2)), intent(out), optional | blks_local_2, | ||
integer, dimension(dbt_nblks_local(tensor, 3)), intent(out), optional | blks_local_3, | ||
integer, dimension(dbt_nblks_local(tensor, 4)), intent(out), optional | blks_local_4, | ||
integer, dimension(dbt_nblks_total(tensor, 1)), intent(out), optional | proc_dist_1, | ||
integer, dimension(dbt_nblks_total(tensor, 2)), intent(out), optional | proc_dist_2, | ||
integer, dimension(dbt_nblks_total(tensor, 3)), intent(out), optional | proc_dist_3, | ||
integer, dimension(dbt_nblks_total(tensor, 4)), intent(out), optional | proc_dist_4, | ||
integer, dimension(dbt_nblks_total(tensor, 1)), intent(out), optional | blk_size_1, | ||
integer, dimension(dbt_nblks_total(tensor, 2)), intent(out), optional | blk_size_2, | ||
integer, dimension(dbt_nblks_total(tensor, 3)), intent(out), optional | blk_size_3, | ||
integer, dimension(dbt_nblks_total(tensor, 4)), intent(out), optional | blk_size_4, | ||
integer, dimension(dbt_nblks_total(tensor, 1)), intent(out), optional | blk_offset_1, | ||
integer, dimension(dbt_nblks_total(tensor, 2)), intent(out), optional | blk_offset_2, | ||
integer, dimension(dbt_nblks_total(tensor, 3)), intent(out), optional | blk_offset_3, | ||
integer, dimension(dbt_nblks_total(tensor, 4)), intent(out), optional | blk_offset_4, | ||
type(dbt_distribution_type), intent(out), optional | distribution, | ||
character(len=*), intent(out), optional | name | ||
) |
As block_get_info but for tensors.
nblks_total | number of blocks along each dimension |
nfull_total | number of elements along each dimension |
nblks_local | local number of blocks along each dimension |
nfull_local | local number of elements along each dimension |
my_ploc | process coordinates in process grid |
pdims | process grid dimensions |
blks_local_4 | local blocks along dimension 4 |
proc_dist_4 | distribution along dimension 4 |
blk_size_4 | block sizes along dimension 4 |
blk_offset_4 | block offsets along dimension 4 |
distribution | distribution object |
name | name of tensor |
Definition at line 1644 of file dbt_types.F.
pure integer function, public dbt_types::dbt_get_num_blocks | ( | type(dbt_type), intent(in) | tensor | ) |
As block_get_num_blocks: get number of local blocks.
Definition at line 1758 of file dbt_types.F.
integer(kind=int_8) function, public dbt_types::dbt_get_num_blocks_total | ( | type(dbt_type), intent(in) | tensor | ) |
Get total number of blocks.
Definition at line 1768 of file dbt_types.F.
subroutine, public dbt_types::dbt_clear | ( | type(dbt_type), intent(inout) | tensor | ) |
Clear tensor (s.t. it does not contain any blocks)
Definition at line 1778 of file dbt_types.F.
subroutine, public dbt_types::dbt_finalize | ( | type(dbt_type), intent(inout) | tensor | ) |
Finalize tensor, as block_finalize. This should be taken care of internally in DBT tensors, there should not be any need to call this routine outside of DBT tensors.
Definition at line 1789 of file dbt_types.F.
subroutine, public dbt_types::dbt_scale | ( | type(dbt_type), intent(inout) | tensor, |
real(dp), intent(in) | alpha | ||
) |
as block_scale
Definition at line 1798 of file dbt_types.F.
pure integer function, public dbt_types::dbt_get_nze | ( | type(dbt_type), intent(in) | tensor | ) |
Definition at line 1807 of file dbt_types.F.
integer(kind=int_8) function, public dbt_types::dbt_get_nze_total | ( | type(dbt_type), intent(in) | tensor | ) |
Definition at line 1816 of file dbt_types.F.
pure integer function, public dbt_types::dbt_blk_size | ( | type(dbt_type), intent(in) | tensor, |
integer, dimension(ndims_tensor(tensor)), intent(in) | ind, | ||
integer, intent(in) | idim | ||
) |
block size of block with index ind along dimension idim
Definition at line 1826 of file dbt_types.F.
pure integer function, public dbt_types::dbt_max_nblks_local | ( | type(dbt_type), intent(in) | tensor | ) |
returns an estimate of maximum number of local blocks in tensor (irrespective of the actual number of currently present blocks) this estimate is based on the following assumption: tensor data is dense and load balancing is within a factor of 2
Definition at line 1849 of file dbt_types.F.
subroutine, public dbt_types::dbt_default_distvec | ( | integer, intent(in) | nblk, |
integer, intent(in) | nproc, | ||
integer, dimension(nblk), intent(in) | blk_size, | ||
integer, dimension(nblk), intent(out) | dist | ||
) |
get a load-balanced and randomized distribution along one tensor dimension
nblk | number of blocks (along one tensor dimension) |
nproc | number of processes (along one process grid dimension) |
blk_size | block sizes |
dist | distribution |
Definition at line 1875 of file dbt_types.F.
subroutine, public dbt_types::dbt_copy_contraction_storage | ( | type(dbt_type), intent(in) | tensor_in, |
type(dbt_type), intent(inout) | tensor_out | ||
) |
Definition at line 1887 of file dbt_types.F.