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.



Variables

Type Visibility Attributes Name Initial
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

    Type IntentOptional Attributes Name
    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

    Type IntentOptional Attributes Name
    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

    Type IntentOptional Attributes Name
    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

    Type IntentOptional Attributes Name
    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

    Type IntentOptional Attributes Name
    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

    Type IntentOptional Attributes Name
    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

Type Visibility Attributes Name Initial
integer, public :: nprowcol = -1
integer(kind=int_8), public :: nmrowcol = -1_int_8

Type-Bound Procedures

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

type, public, extends(dbcsr_tas_distribution) ::  dbcsr_tas_dist_cyclic

Components

Type Visibility Attributes Name Initial
integer, public :: nprowcol = -1
integer(kind=int_8), public :: nmrowcol = -1_int_8
integer, public :: split_size = -1

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

Type Visibility Attributes Name Initial
integer, public :: nprowcol = -1
integer(kind=int_8), public :: nmrowcol = -1_int_8
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

Type Visibility Attributes Name Initial
integer, public :: nprowcol = -1
integer(kind=int_8), public :: nmrowcol = -1_int_8
integer, public, DIMENSION(:), ALLOCATABLE :: dist_vec
integer, public :: nmrowcol_local = -1
integer, public :: n_repl = -1
integer, public :: dist_size = -1

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

Type Visibility Attributes Name Initial
integer(kind=int_8), public :: nmrowcol = -1_int_8
integer(kind=int_8), public :: nfullrowcol = -1_int_8

Type-Bound Procedures

procedure(rowcol_data), public, deferred :: DATA

type, public, extends(dbcsr_tas_rowcol_data) ::  dbcsr_tas_blk_size_arb

Components

Type Visibility Attributes Name Initial
integer(kind=int_8), public :: nmrowcol = -1_int_8
integer(kind=int_8), public :: nfullrowcol = -1_int_8
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

type, public, extends(dbcsr_tas_rowcol_data) ::  dbcsr_tas_blk_size_repl

Components

Type Visibility Attributes Name Initial
integer(kind=int_8), public :: nmrowcol = -1_int_8
integer(kind=int_8), public :: nfullrowcol = -1_int_8
integer, public, DIMENSION(:), ALLOCATABLE :: blk_size_vec
integer, public :: nmrowcol_local = -1

Constructor

private function new_dbcsr_tas_blk_size_repl (blk_size_vec, n_repl)

Type-Bound Procedures

procedure, public :: DATA => blk_size_repl

type, public, extends(dbcsr_tas_rowcol_data) ::  dbcsr_tas_blk_size_one

Components

Type Visibility Attributes Name Initial
integer(kind=int_8), public :: nmrowcol = -1_int_8
integer(kind=int_8), public :: nfullrowcol = -1_int_8

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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
integer(kind=int_8), intent(in) :: nrowcol

Return Value type(dbcsr_tas_blk_size_one)

private function arb_dist(t, rowcol)

Arguments

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
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

Type IntentOptional Attributes Name
integer, intent(in) :: nel
integer, intent(in) :: nbin
integer, intent(in), DIMENSION(nel) :: weights
integer, intent(out), DIMENSION(nel) :: dist