dbcsr_tas_split Module

methods to split tall-and-skinny matrices along longest dimension. Basically, we are splitting process grid and each subgrid holds its own DBCSR matrix.



Variables

Type Visibility Attributes Name Initial
character(len=*), private, parameter :: moduleN = 'dbcsr_tas_split'
integer, public, parameter :: rowsplit = 1
integer, public, parameter :: colsplit = 2
real(kind=real_8), public, parameter :: default_pdims_accept_ratio = 1.2_real_8
real(kind=real_8), public, parameter :: default_nsplit_accept_ratio = 3.0_real_8

Interfaces

private interface dbcsr_tas_mp_comm

  • private interface dbcsr_tas_mp_comm()

    Arguments

    None
  • private function dbcsr_tas_mp_comm_from_matrix_sizes(mp_comm, nblkrows, nblkcols) result(mp_comm_new)

    Derive optimal cartesian process grid from matrix sizes. This ensures optimality for dense matrices only

    Arguments

    Type IntentOptional Attributes Name
    type(mp_comm_type), intent(in) :: mp_comm
    integer(kind=int_8), intent(in) :: nblkrows

    total number of block rows total number of block columns

    integer(kind=int_8), intent(in) :: nblkcols

    total number of block rows total number of block columns

    Return Value type(mp_comm_type)

    MPI communicator


Functions

public function dbcsr_tas_mp_comm(mp_comm, split_rowcol, nsplit)

Create default cartesian process grid that is consistent with default split heuristic of dbcsr_tas_create_split \return new communicator

Arguments

Type IntentOptional Attributes Name
type(mp_comm_type), intent(in) :: mp_comm
integer, intent(in) :: split_rowcol
integer, intent(in) :: nsplit

Return Value type(mp_comm_type)

public function dbcsr_tas_mp_dims(numproc, split_rowcol, nsplit)

Get optimal process grid dimensions consistent with dbcsr_tas_create_split

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: numproc
integer, intent(in) :: split_rowcol
integer, intent(in) :: nsplit

Return Value integer, DIMENSION(2)

private function get_opt_nsplit(numproc, nsplit, split_pgrid, pdim_nonsplit)

Heuristic to get good split factor for a given process grid OR a given number of processes \return split factor consistent with process grid or number of processes

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: numproc

total number of processes or (if split_pgrid) process grid dimension to split Desired split factor

integer, intent(in) :: nsplit

total number of processes or (if split_pgrid) process grid dimension to split Desired split factor

logical, intent(in) :: split_pgrid

whether to split process grid

integer, intent(in), optional :: pdim_nonsplit

if split_pgrid: other process grid dimension

Return Value integer

private function dbcsr_tas_mp_comm_from_matrix_sizes(mp_comm, nblkrows, nblkcols) result(mp_comm_new)

Derive optimal cartesian process grid from matrix sizes. This ensures optimality for dense matrices only

Arguments

Type IntentOptional Attributes Name
type(mp_comm_type), intent(in) :: mp_comm
integer(kind=int_8), intent(in) :: nblkrows

total number of block rows total number of block columns

integer(kind=int_8), intent(in) :: nblkcols

total number of block rows total number of block columns

Return Value type(mp_comm_type)

MPI communicator

public function accept_pgrid_dims(dims, relative)

Whether to accept proposed process grid dimensions (based on ratio of dimensions)

Arguments

Type IntentOptional Attributes Name
integer, intent(in), DIMENSION(2) :: dims
logical, intent(in) :: relative

Return Value logical

private function i8_bsearch(array, el, l_index, u_index) result(res)

binary search for 8-byte integers

Arguments

Type IntentOptional Attributes Name
integer(kind=int_8), intent(in) :: array(:)
integer(kind=int_8), intent(in) :: el
integer, intent(in), optional :: l_index
integer, intent(in), optional :: u_index

Return Value integer


Subroutines

public subroutine dbcsr_tas_create_split_rows_or_cols(split_info, mp_comm, ngroup, igroup, split_rowcol, own_comm)

split mpi grid by rows or columns

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(out) :: split_info
type(mp_comm_type), intent(in) :: mp_comm

global mpi communicator with a 2d cartesian grid

integer, intent(inout) :: ngroup

number of groups

integer, intent(in) :: igroup

my group ID split rows or columns

integer, intent(in) :: split_rowcol

my group ID split rows or columns

logical, intent(in), optional :: own_comm

Whether split_info should own communicator

public subroutine dbcsr_tas_create_split(split_info, mp_comm, split_rowcol, nsplit, own_comm, opt_nsplit)

Split Cartesian process grid using a default split heuristic.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(out) :: split_info

object storing all data corresponding to split, submatrices and parallelization

type(mp_comm_type), intent(in) :: mp_comm

MPI communicator with associated cartesian grid

integer, intent(in) :: split_rowcol

split rows or columns

integer, intent(in) :: nsplit

desired split factor, set to 0 if split factor of exactly 1 is required

logical, intent(in), optional :: own_comm

whether split_info should own communicator

logical, intent(in), optional :: opt_nsplit

whether nsplit should be optimized to process grid

public subroutine dbcsr_tas_get_split_info(info, mp_comm, nsplit, igroup, mp_comm_group, split_rowcol, pgrid_offset)

Get info on split

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(in) :: info
type(mp_comm_type), intent(out), optional :: mp_comm
integer, intent(out), optional :: nsplit

communicator (global process grid) split factor which group do I belong to subgroup communicator (group-local process grid) split rows or columns

integer, intent(out), optional :: igroup

communicator (global process grid) split factor which group do I belong to subgroup communicator (group-local process grid) split rows or columns

type(mp_comm_type), intent(out), optional :: mp_comm_group
integer, intent(out), optional :: split_rowcol

communicator (global process grid) split factor which group do I belong to subgroup communicator (group-local process grid) split rows or columns

integer, intent(out), optional, DIMENSION(2) :: pgrid_offset

group-local offset in process grid

public subroutine dbcsr_tas_release_info(split_info)

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(inout) :: split_info

public subroutine dbcsr_tas_info_hold(split_info)

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(in) :: split_info

public subroutine world_to_group_proc_map(iproc, pdims, split_rowcol, pgrid_split_size, igroup, pdims_group, iproc_group)

map global process info to group

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iproc

global process ID

integer, intent(in), DIMENSION(2) :: pdims

global process dimensions

integer, intent(in) :: split_rowcol

split rows or column how many process rows/cols per group

integer, intent(in) :: pgrid_split_size

split rows or column how many process rows/cols per group

integer, intent(out) :: igroup

group ID

integer, intent(out), optional, DIMENSION(2) :: pdims_group

local process grid dimensions

integer, intent(out), optional :: iproc_group

group local process ID

public subroutine group_to_world_proc_map(iproc, pdims, split_rowcol, pgrid_split_size, igroup, iproc_group)

map local process info to global info

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: iproc

global process id

integer, intent(in), DIMENSION(2) :: pdims

global process grid dimensions

integer, intent(in) :: split_rowcol

split rows or column how many process rows/cols per group group ID local process ID

integer, intent(in) :: pgrid_split_size

split rows or column how many process rows/cols per group group ID local process ID

integer, intent(in) :: igroup

split rows or column how many process rows/cols per group group ID local process ID

integer, intent(in) :: iproc_group

split rows or column how many process rows/cols per group group ID local process ID

public subroutine block_index_local_to_global(info, dist, row_group, column_group, row, column)

map group local block index to global matrix index

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(in) :: info
type(dbcsr_tas_distribution_type), intent(in) :: dist
integer, intent(in), optional :: row_group

group local row block index group local column block index

integer, intent(in), optional :: column_group

group local row block index group local column block index

integer(kind=int_8), intent(out), optional :: row

global block row global block column

integer(kind=int_8), intent(out), optional :: column

global block row global block column

public subroutine block_index_global_to_local(info, dist, row, column, row_group, column_group)

map global block index to group local index

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(in) :: info
type(dbcsr_tas_distribution_type), intent(in) :: dist
integer(kind=int_8), intent(in), optional :: row
integer(kind=int_8), intent(in), optional :: column
integer, intent(out), optional :: row_group
integer, intent(out), optional :: column_group

public subroutine group_to_mrowcol(info, rowcol_dist, igroup, rowcols)

maps a process subgroup to matrix rows/columns

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(in) :: info
class(dbcsr_tas_distribution), intent(in) :: rowcol_dist
integer, intent(in) :: igroup

group ID

integer(kind=int_8), intent(out), DIMENSION(:), ALLOCATABLE :: rowcols

rows/ columns on this group

public subroutine dbcsr_tas_set_strict_split(info)

freeze current split factor such that it is never changed during multiplication

Arguments

Type IntentOptional Attributes Name
type(dbcsr_tas_split_info), intent(inout) :: info