dbcsr_mm_common Module

Common variables and routines for the dbcsr matrix-matrix multiplication algorithms. Modification history: - 2016-08 Code organization (Alfio Lazzaro).



Variables

Type Visibility Attributes Name Initial
character(len=*), private, parameter :: moduleN = 'dbcsr_mm_common'
type(dbcsr_memtype_type_p), public, DIMENSION(:), POINTER, SAVE :: memtype_product_wm => Null()
type(dbcsr_mpi_statistics_type), public, SAVE :: dbcsr_mpi_statistics
integer, public, SAVE :: num_multiplications = 0
real, public, SAVE :: max_memory = 0
real, public, parameter :: huge_norm = HUGE(1.0)**(1.0/3.0)
type(dbcsr_memtype_type), public, SAVE :: memtype_abpanel_1
type(dbcsr_memtype_type), public, SAVE :: memtype_abpanel_2
type(dbcsr_memtype_type), public, SAVE :: memtype_trsbuffer_1
type(dbcsr_memtype_type), public, SAVE :: memtype_trsbuffer_2
type(dbcsr_memtype_type), public, SAVE :: memtype_normsbuf
type(dbcsr_memtype_type), public, SAVE :: memtype_offsetsbuf
type(dbcsr_memtype_type), public, SAVE :: memtype_nelemsbuf
type(dbcsr_memtype_type), public, SAVE :: memtype_mpi_buffer
type(dbcsr_memtype_type), public, SAVE :: memtype_mpi_product
type(acc_stream_type), public, SAVE :: stream_1
type(acc_stream_type), public, SAVE :: stream_2

Derived Types

type, private ::  dbcsr_memtype_type_p

Components

Type Visibility Attributes Name Initial
type(dbcsr_memtype_type), public, POINTER :: p => Null()
integer(kind=int_4), public, DIMENSION(64) :: padding = -1_int_4

type, public ::  dbcsr_mm_multrec_type_p

Components

Type Visibility Attributes Name Initial
type(dbcsr_mm_multrec_type), public, POINTER :: p => Null()
integer(kind=int_4), public, DIMENSION(64) :: padding

Functions

public function product_matrix_size_guess(matrix_left, matrix_right, product_matrix, left_data_size, right_data_size, left_col_nimages, right_row_nimages, nthreads) result(size_guess)

Guess the size of the product matrix from the A and B sparsities

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(in) :: matrix_left
type(dbcsr_type), intent(in) :: matrix_right
type(dbcsr_type), intent(in) :: product_matrix
integer, intent(in) :: left_data_size
integer, intent(in) :: right_data_size
integer, intent(in) :: left_col_nimages
integer, intent(in) :: right_row_nimages
integer, intent(in) :: nthreads

Return Value integer


Subroutines

public subroutine count_mpi_statistics(mpi_statistics, data_size, element_size_bytes, size_breakdown)

Arguments

Type IntentOptional Attributes Name
real, intent(inout), DIMENSION(:) :: mpi_statistics
integer, intent(in) :: data_size
integer, intent(in) :: element_size_bytes
integer(kind=int_8), intent(inout), optional, DIMENSION(:, :) :: size_breakdown

public subroutine setup_buffer_matrix(matrix, source_matrix, index_size, data_size, data_buffer, data_memory_type)

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(inout) :: matrix
type(dbcsr_type), intent(in) :: source_matrix
integer, intent(in), optional :: index_size
integer, intent(in), optional :: data_size
type(dbcsr_data_obj), intent(in), optional :: data_buffer
type(dbcsr_memtype_type), intent(in), optional :: data_memory_type

public recursive subroutine rec_sort_index(mi, mf, ni, nf, nele, a, d)

Sorts index for recursing.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: mi
integer, intent(in) :: mf
integer, intent(in) :: ni
integer, intent(in) :: nf
integer, intent(in) :: nele
integer, intent(inout), DIMENSION(3, 1:nele) :: a
integer, intent(in) :: d

private subroutine rec_split(nele, a, split, row_or_col, nlow, mi, half)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nele
integer, intent(in), DIMENSION(3, nele) :: a
integer, intent(out), DIMENSION(3, nele) :: split
integer, intent(in) :: row_or_col
integer, intent(out) :: nlow
integer, intent(in) :: mi
integer, intent(in) :: half

public subroutine enumerate_blk_sizes(blk_sizes, max_size, enum, rev_enum)

Enumerate all occurring blocksizes

Arguments

Type IntentOptional Attributes Name
integer, DIMENSION(:), POINTER, CONTIGUOUS :: blk_sizes
integer, intent(in) :: max_size
integer, DIMENSION(:), POINTER, CONTIGUOUS :: enum
integer, DIMENSION(:), POINTER, CONTIGUOUS :: rev_enum

public subroutine acc_transpose_blocks(matrix, trs_stackbuf, row_blk_sizes, col_blk_sizes, row_blk_sizes2enum, enum2row_blk_sizes, col_blk_sizes2enum, enum2col_blk_sizes, noresize)

write out a stack for transposing the blocks

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(in) :: matrix
type(dbcsr_data_obj), intent(inout) :: trs_stackbuf
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: row_blk_sizes
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: col_blk_sizes
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: row_blk_sizes2enum
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: enum2row_blk_sizes
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: col_blk_sizes2enum
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: enum2col_blk_sizes
logical, intent(in), optional :: noresize

public subroutine acc_calculate_norms(matrix, norms, normsbuf, offsetsbuf, nelemsbuf, row_blk_sizes, col_blk_sizes)

calculate norms for a set of blocks in matrix whose row and col sizes are given

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(in) :: matrix
real(kind=sp), intent(out), DIMENSION(:) :: norms
type(dbcsr_data_obj), intent(inout), TARGET :: normsbuf
type(dbcsr_data_obj), intent(inout), TARGET :: offsetsbuf
type(dbcsr_data_obj), intent(inout), TARGET :: nelemsbuf
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: row_blk_sizes
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: col_blk_sizes

public subroutine calculate_norms(matrix, norms, row_blk_sizes, col_blk_sizes)

Calculates per-block norms. Rewritten to be very low-level.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(in) :: matrix

DBCSR matrix for which to calculate norms

real(kind=sp), intent(out), DIMENSION(:) :: norms

Block norms

integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: row_blk_sizes
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: col_blk_sizes

public pure subroutine local_filter(full_data, nle, local_elements, local_data)

Gathers the local elements from all data (full_data)

Arguments

Type IntentOptional Attributes Name
integer, intent(in), DIMENSION(:), CONTIGUOUS :: full_data

All elements

integer, intent(in) :: nle

Number of local elements

integer, intent(in), DIMENSION(1:nle) :: local_elements

List of local elements

integer, intent(out), DIMENSION(1:nle) :: local_data

Local elements obtained from all elements

private subroutine calc_norms_d(norms, nblks, blki, rbs, cbs, DATA)

Calculates norms of the entire matrix with minimal overhead.

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(out), DIMENSION(:) :: norms
integer, intent(in) :: nblks
integer, intent(in), DIMENSION(3, nblks) :: blki
integer, intent(in), DIMENSION(:) :: rbs
integer, intent(in), DIMENSION(:) :: cbs
real(kind=real_8), intent(in), DIMENSION(:) :: DATA

private subroutine calc_norms_s(norms, nblks, blki, rbs, cbs, DATA)

Calculates norms of the entire matrix with minimal overhead.

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(out), DIMENSION(:) :: norms
integer, intent(in) :: nblks
integer, intent(in), DIMENSION(3, nblks) :: blki
integer, intent(in), DIMENSION(:) :: rbs
integer, intent(in), DIMENSION(:) :: cbs
real(kind=real_4), intent(in), DIMENSION(:) :: DATA

private subroutine calc_norms_z(norms, nblks, blki, rbs, cbs, DATA)

Calculates norms of the entire matrix with minimal overhead.

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(out), DIMENSION(:) :: norms
integer, intent(in) :: nblks
integer, intent(in), DIMENSION(3, nblks) :: blki
integer, intent(in), DIMENSION(:) :: rbs
integer, intent(in), DIMENSION(:) :: cbs
complex(kind=real_8), intent(in), DIMENSION(:) :: DATA

private subroutine calc_norms_c(norms, nblks, blki, rbs, cbs, DATA)

Calculates norms of the entire matrix with minimal overhead.

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(out), DIMENSION(:) :: norms
integer, intent(in) :: nblks
integer, intent(in), DIMENSION(3, nblks) :: blki
integer, intent(in), DIMENSION(:) :: rbs
integer, intent(in), DIMENSION(:) :: cbs
complex(kind=real_4), intent(in), DIMENSION(:) :: DATA