dbcsr_tas_global Module

Global data (distribution and block sizes) for tall-and-skinny matrices For very sparse matrices with one very large dimension, storing array data of the same size as the matrix dimensions may require too much memory and we need to compute them on the fly for a given row or column. Hence global array data such as distribution and block sizes are specified as function objects, leaving up to the caller how to efficiently store global data.



Contents


Variables

TypeVisibilityAttributesNameInitial
character(len=*), private, parameter:: moduleN ='dbcsr_tas_global'

Interfaces

public interface dbcsr_tas_dist_cyclic

  • private function new_dbcsr_tas_dist_cyclic(split_size, nprowcol, nmrowcol)

    Arguments

    TypeIntentOptionalAttributesName
    integer, intent(in) :: split_size
    integer, intent(in) :: nprowcol
    integer(kind=int_8), intent(in) :: nmrowcol

    Return Value type(dbcsr_tas_dist_cyclic)

public interface dbcsr_tas_dist_arb

  • private function new_dbcsr_tas_dist_arb(dist_vec, nprowcol, nmrowcol)

    Arguments

    TypeIntentOptionalAttributesName
    integer, intent(in), DIMENSION(:):: dist_vec
    integer, intent(in) :: nprowcol
    integer(kind=int_8), intent(in) :: nmrowcol

    Return Value type(dbcsr_tas_dist_arb)

public interface dbcsr_tas_dist_repl

  • private function new_dbcsr_tas_dist_repl(dist_vec, nprowcol, nmrowcol, n_repl, dist_size)

    Arguments

    TypeIntentOptionalAttributesName
    integer, intent(in), DIMENSION(:):: dist_vec
    integer, intent(in) :: nprowcol
    integer, intent(in) :: nmrowcol
    integer, intent(in) :: n_repl
    integer, intent(in) :: dist_size

    Return Value type(dbcsr_tas_dist_repl)

public interface dbcsr_tas_blk_size_arb

public interface dbcsr_tas_blk_size_repl

public interface dbcsr_tas_blk_size_one


Abstract Interfaces

abstract interface

  • private function rowcol_dist(t, rowcol)

    map matrix rows/cols to distribution rows/cols:

    Arguments

    TypeIntentOptionalAttributesName
    class(dbcsr_tas_distribution), intent(in) :: t
    integer(kind=int_8), intent(in) :: rowcol

    Return Value integer

abstract interface

  • private function dist_rowcols(t, dist)

    map distribution rows/cols to matrix rows/cols:

    Arguments

    TypeIntentOptionalAttributesName
    class(dbcsr_tas_distribution), intent(in) :: t
    integer, intent(in) :: dist

    Return Value integer(kind=int_8),DIMENSION(:), ALLOCATABLE

abstract interface

  • private function rowcol_data(t, rowcol)

    integer data for each block row / col

    Arguments

    TypeIntentOptionalAttributesName
    class(dbcsr_tas_rowcol_data), intent(in) :: t
    integer(kind=int_8), intent(in) :: rowcol

    Return Value integer


Derived Types

type, public, ABSTRACT :: dbcsr_tas_distribution

Components

TypeVisibilityAttributesNameInitial
integer, public :: nprowcol
integer(kind=int_8), public :: nmrowcol

Type-Bound Procedures

procedure(rowcol_dist), public :: dist
procedure(dist_rowcols), public :: rowcols

Components

TypeVisibilityAttributesNameInitial
integer, public :: nprowcol
integer(kind=int_8), public :: nmrowcol
integer, public :: split_size

Constructor

private function new_dbcsr_tas_dist_cyclic(split_size, nprowcol, nmrowcol)

Type-Bound Procedures

procedure, public :: dist => cyclic_dist
procedure, public :: rowcols => cyclic_rowcols

type, public, extends(dbcsr_tas_distribution) :: dbcsr_tas_dist_arb

Components

TypeVisibilityAttributesNameInitial
integer, public :: nprowcol
integer(kind=int_8), public :: nmrowcol
integer, public, DIMENSION(:), ALLOCATABLE:: dist_vec

Constructor

private function new_dbcsr_tas_dist_arb(dist_vec, nprowcol, nmrowcol)

Type-Bound Procedures

procedure, public :: dist => arb_dist
procedure, public :: rowcols => arb_rowcols

type, public, extends(dbcsr_tas_distribution) :: dbcsr_tas_dist_repl

Components

TypeVisibilityAttributesNameInitial
integer, public :: nprowcol
integer(kind=int_8), public :: nmrowcol
integer, public, DIMENSION(:), ALLOCATABLE:: dist_vec
integer, public :: nmrowcol_local
integer, public :: n_repl
integer, public :: dist_size

Constructor

private function new_dbcsr_tas_dist_repl(dist_vec, nprowcol, nmrowcol, n_repl, dist_size)

Type-Bound Procedures

procedure, public :: dist => repl_dist
procedure, public :: rowcols => repl_rowcols

type, public, ABSTRACT :: dbcsr_tas_rowcol_data

Components

TypeVisibilityAttributesNameInitial
integer(kind=int_8), public :: nmrowcol
integer(kind=int_8), public :: nfullrowcol

Type-Bound Procedures

procedure(rowcol_data), public :: DATA

Components

TypeVisibilityAttributesNameInitial
integer(kind=int_8), public :: nmrowcol
integer(kind=int_8), public :: nfullrowcol
integer, public, DIMENSION(:), ALLOCATABLE:: blk_size_vec

Constructor

private function new_dbcsr_tas_blk_size_arb(blk_size_vec)

Type-Bound Procedures

procedure, public :: DATA => blk_size_arb

Components

TypeVisibilityAttributesNameInitial
integer(kind=int_8), public :: nmrowcol
integer(kind=int_8), public :: nfullrowcol
integer, public, DIMENSION(:), ALLOCATABLE:: blk_size_vec
integer, public :: nmrowcol_local

Constructor

private function new_dbcsr_tas_blk_size_repl(blk_size_vec, n_repl)

Type-Bound Procedures

procedure, public :: DATA => blk_size_repl

Components

TypeVisibilityAttributesNameInitial
integer(kind=int_8), public :: nmrowcol
integer(kind=int_8), public :: nfullrowcol

Constructor

private function new_dbcsr_tas_blk_size_one(nrowcol)

Type-Bound Procedures

procedure, public :: DATA => blk_size_one

Functions

private function blk_size_arb(t, rowcol)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_blk_size_arb), intent(in) :: t
integer(kind=int_8), intent(in) :: rowcol

Return Value integer

private function blk_size_repl(t, rowcol)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_blk_size_repl), intent(in) :: t
integer(kind=int_8), intent(in) :: rowcol

Return Value integer

private function blk_size_one(t, rowcol)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_blk_size_one), intent(in) :: t
integer(kind=int_8), intent(in) :: rowcol

Return Value integer

private function new_dbcsr_tas_blk_size_arb(blk_size_vec)

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), DIMENSION(:):: blk_size_vec

Return Value type(dbcsr_tas_blk_size_arb)

private function new_dbcsr_tas_blk_size_repl(blk_size_vec, n_repl)

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), DIMENSION(:):: blk_size_vec
integer, intent(in) :: n_repl

Return Value type(dbcsr_tas_blk_size_repl)

private function new_dbcsr_tas_blk_size_one(nrowcol)

Arguments

TypeIntentOptionalAttributesName
integer(kind=int_8), intent(in) :: nrowcol

Return Value type(dbcsr_tas_blk_size_one)

private function arb_dist(t, rowcol)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_dist_arb), intent(in) :: t
integer(kind=int_8), intent(in) :: rowcol

Return Value integer

private function repl_dist(t, rowcol)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_dist_repl), intent(in) :: t
integer(kind=int_8), intent(in) :: rowcol

Return Value integer

private function repl_rowcols(t, dist)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_dist_repl), intent(in) :: t
integer, intent(in) :: dist

Return Value integer(kind=int_8),DIMENSION(:), ALLOCATABLE

private function arb_rowcols(t, dist)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_dist_arb), intent(in) :: t
integer, intent(in) :: dist

Return Value integer(kind=int_8),DIMENSION(:), ALLOCATABLE

private function new_dbcsr_tas_dist_cyclic(split_size, nprowcol, nmrowcol)

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: split_size
integer, intent(in) :: nprowcol
integer(kind=int_8), intent(in) :: nmrowcol

Return Value type(dbcsr_tas_dist_cyclic)

private function new_dbcsr_tas_dist_arb(dist_vec, nprowcol, nmrowcol)

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), DIMENSION(:):: dist_vec
integer, intent(in) :: nprowcol
integer(kind=int_8), intent(in) :: nmrowcol

Return Value type(dbcsr_tas_dist_arb)

public function dbcsr_tas_dist_arb_default(nprowcol, nmrowcol, block_sizes)

Distribution that is more or less cyclic (round robin) and load balanced with different weights for each element. This is used for creating adhoc distributions whenever matrices are mapped to new grids. Only for small dimensions since distribution is created as an array

Arguments

TypeIntentOptionalAttributesName
integer :: nprowcol
integer(kind=int_8), intent(in) :: nmrowcol
class(dbcsr_tas_rowcol_data), intent(in) :: block_sizes

Return Value type(dbcsr_tas_dist_arb)

private function new_dbcsr_tas_dist_repl(dist_vec, nprowcol, nmrowcol, n_repl, dist_size)

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), DIMENSION(:):: dist_vec
integer, intent(in) :: nprowcol
integer, intent(in) :: nmrowcol
integer, intent(in) :: n_repl
integer, intent(in) :: dist_size

Return Value type(dbcsr_tas_dist_repl)

private function cyclic_dist(t, rowcol)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_dist_cyclic), intent(in) :: t
integer(kind=int_8), intent(in) :: rowcol

Return Value integer

private function cyclic_rowcols(t, dist)

Arguments

TypeIntentOptionalAttributesName
class(dbcsr_tas_dist_cyclic), intent(in) :: t
integer, intent(in) :: dist

Return Value integer(kind=int_8),DIMENSION(:), ALLOCATABLE


Subroutines

public subroutine dbcsr_tas_default_distvec(nblk, nproc, blk_size, dist)

get a load-balanced and randomized distribution along one tensor dimension

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: nblk

number of blocks (along one tensor dimension)

integer, intent(in) :: nproc

number of processes (along one process grid dimension)

integer, intent(in), DIMENSION(nblk):: blk_size

block sizes

integer, intent(out), DIMENSION(nblk):: dist

distribution

private subroutine distribute_lpt_random(nel, nbin, weights, dist)

distribute nel elements with weights weights over nbin bins. load balanced distribution is obtained by using LPT algorithm together with randomization over equivalent bins (i.e. randomization over all bins with the smallest accumulated weight)

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: nel
integer, intent(in) :: nbin
integer, intent(in), DIMENSION(nel):: weights
integer, intent(out), DIMENSION(nel):: dist