Documentation for module dbcsr_csr_conversions

DBCSR to CSR matrix format conversion

source: dbcsr_csr_conversions.F
Loading...

public Types:

csr_type
Type for CSR matrices
csr_p_type
...

public Subroutines/Functions:

convert a CSR matrix to a DBCSR matrix
Convert a DBCSR matrix to a CSR matrix.
create CSR matrix including dbcsr_mapping from arbitrary DBCSR matrix in order to prepare conversion.
Create a new CSR matrix and allocate all internal data (excluding dbcsr_mapping)
Create a new CSR matrix and allocate all internal data using an existing CSR matrix. Copies the indices but no actual matrix data.
SUBROUTINE
csr_destroy (csr_mat)
destroy a CSR matrix
Print CSR sparsity
Write a CSR matrix to file
Apply filtering threshold eps to DBCSR blocks in order to improve CSR sparsity (currently only used for testing purposes)

Parameters:

INTEGER
:: csr_dbcsr_blkrow_dist = 1
INTEGER
:: csr_eqrow_ceil_dist = 2
INTEGER
:: csr_eqrow_floor_dist = 3

public Types:

TYPE :: csr_p_type

...


TYPE(csr_type),
POINTER :: csr_mat ...

TYPE :: csr_type

Type for CSR matrices


INTEGER
:: nrows_total total number of rows
INTEGER
:: ncols_total total number of columns
INTEGER
:: nze_local local number of nonzero elements
INTEGER
:: nrows_local local number of rows
INTEGER
:: mp_group message-passing group ID
INTEGER(int_8)
:: nze_total total number of nonzero elements
INTEGER,
DIMENSION(:), POINTER :: rowptr_local => NULL() indices of elements inside nzval_local starting a row
INTEGER,
DIMENSION(:), POINTER :: colind_local => NULL() column indices of elements inside nzval_local
INTEGER,
DIMENSION(:), POINTER :: nzerow_local => NULL() ...
:: nzval_local values of local non-zero elements, row-wise ordering.
:: dbcsr_mapping mapping data relating indices of nzval_local to indices of a block-row distributed DBCSR matrix
LOGICAL
:: has_mapping = .FALSE. whether dbcsr_mapping is defined
LOGICAL
:: valid = .FALSE. whether essential data (excluding dbcsr_mapping) is completely allocated
LOGICAL
:: has_indices = .FALSE. whether rowptr_local and colind_local are defined

SUBROUTINEconvert_csr_to_dbcsr(dbcsr_mat, csr_mat)

convert a CSR matrix to a DBCSR matrix

Arguments:
TYPE(dbcsr_type),
INTENT(inout)
:: dbcsr_mat correctly allocated DBCSR matrix
TYPE(csr_type),
INTENT(inout)
:: csr_mat CSR matrix to convert

SUBROUTINEconvert_dbcsr_to_csr(dbcsr_mat, csr_mat)

Convert a DBCSR matrix to a CSR matrix.

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: dbcsr_mat DBCSR matrix to convert
TYPE(csr_type),
INTENT(inout)
:: csr_mat correctly allocated CSR matrix

SUBROUTINEcsr_create_from_dbcsr(dbcsr_mat, csr_mat, dist_format, csr_sparsity, numnodes)

create CSR matrix including dbcsr_mapping from arbitrary DBCSR matrix in order to prepare conversion.

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: dbcsr_mat ...
TYPE(csr_type),
INTENT(out)
:: csr_mat ...
INTEGER,
INTENT(in)
:: dist_format how to distribute CSR rows over processes: csr_dbcsr_blkrow_dist: the number of rows per process is adapted to the row block sizes in the DBCSR format such that blocks are not splitted over different processes. csr_eqrow_ceil_dist: each process holds ceiling(N/P) CSR rows. csr_eqrow_floor_dist: each process holds floor(N/P) CSR rows.
TYPE(dbcsr_type),
INTENT(in),
OPTIONAL
:: csr_sparsity DBCSR matrix containing 0 and 1, representing CSR sparsity pattern 1: non-zero element 0: zero element (not present in CSR format) Note: matrix must be of data_type dbcsr_type_real_4 or dbcsr_type_real_8 (integer types not supported)
INTEGER,
INTENT(in),
OPTIONAL
:: numnodes number of nodes to use for distributing CSR matrix (optional, default is number of nodes used for DBCSR matrix)

SUBROUTINEcsr_create_new(csr_mat, nrows_total, ncols_total, nze_total, nze_local, nrows_local, mp_group, data_type)

Create a new CSR matrix and allocate all internal data (excluding dbcsr_mapping)

Arguments:
TYPE(csr_type),
INTENT(out)
:: csr_mat CSR matrix to return
INTEGER,
INTENT(in)
:: nrows_total total number of rows
INTEGER,
INTENT(in)
:: ncols_total total number of columns
INTEGER(int_8)
:: nze_total total number of non-zero elements
INTEGER,
INTENT(in)
:: nze_local local number of non-zero elements
INTEGER,
INTENT(in)
:: nrows_local local number of rows
INTEGER,
INTENT(in)
:: mp_group ...
INTEGER,
INTENT(in),
OPTIONAL
:: data_type data type of the CSR matrix (default real double prec.)

SUBROUTINEcsr_create_template(matrix_b, matrix_a)

Create a new CSR matrix and allocate all internal data using an existing CSR matrix. Copies the indices but no actual matrix data.

Arguments:
TYPE(csr_type),
INTENT(out)
:: matrix_b Target CSR matrix
TYPE(csr_type),
INTENT(in)
:: matrix_a Source CSR matrix

SUBROUTINEcsr_destroy(csr_mat)

destroy a CSR matrix

Arguments:
TYPE(csr_type),
INTENT(inout)
:: csr_mat ...

SUBROUTINEcsr_print_sparsity(csr_mat, unit_nr)

Print CSR sparsity

Arguments:
TYPE(csr_type),
INTENT(in)
:: csr_mat ...
INTEGER,
INTENT(in)
:: unit_nr ...

SUBROUTINEcsr_write(csr_mat, unit_nr, upper_triangle, threshold)

Write a CSR matrix to file

Arguments:
TYPE(csr_type),
INTENT(in)
:: csr_mat ...
INTEGER,
INTENT(in)
:: unit_nr unit number to which output is written
LOGICAL,
INTENT(in),
OPTIONAL
:: upper_triangle If true (default: false), write only upper triangular part of matrix
REAL(real_8),
INTENT(in),
OPTIONAL
:: threshold threshold on the absolute value of the elements to be printed

SUBROUTINEdbcsr_to_csr_filter(dbcsr_mat, csr_sparsity, eps)

Apply filtering threshold eps to DBCSR blocks in order to improve CSR sparsity (currently only used for testing purposes)

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: dbcsr_mat ...
TYPE(dbcsr_type),
INTENT(out)
:: csr_sparsity ...
REAL(real_8),
INTENT(in)
:: eps ...

private Parameters/Types:

private Types:

TYPE :: csr_data_area_type

Data type of CSR matrices


REAL(real_4),
DIMENSION(:), POINTER :: r_sp => NULL() real, single precision data array
REAL(real_8),
DIMENSION(:), POINTER :: r_dp => NULL() real, double precision data array
COMPLEX(real_4),
DIMENSION(:), POINTER :: c_sp => NULL() complex, double precision data array
COMPLEX(real_8),
DIMENSION(:), POINTER :: c_dp => NULL() ...
INTEGER
:: data_type = -1 data type of CSR matrix

TYPE :: csr_mapping_data

Mapping data relating local CSR indices to local indices of a block-row distributed (BRD) DBCSR matrix, and containing the block structure of the original DBCSR matrix from which the CSR matrix was created.


INTEGER,
DIMENSION(:), POINTER :: csr_to_brd_ind => NULL() csr_to_brd_ind(csr_ind) gives the location of a matrix element with CSR index csr_ind (location in nzval_local) inside the data_area of the corresponding BRD matrix. If an element of the DBCSR matrix is treated as 0 in the CSR format, the index of this value is not in csr_to_brd_ind.
INTEGER,
DIMENSION(:), POINTER :: brd_to_csr_ind => NULL() same as csr_to_brd_ind but inverse mapping. If a given DBCSR index dbcsr_ind points to a zero element, then brd_to_csr_ind(dbcsr_ind) is -1.
:: brd_mat DBCSR BRD matrix acting as an intermediate step in any conversion from and to DBCSR format.
LOGICAL
:: has_dbcsr_block_data = .FALSE. whether dbcsr_* fields are defined
INTEGER
:: dbcsr_nblkcols_total ...
INTEGER
:: dbcsr_nblkrows_total ...
INTEGER
:: dbcsr_nblks_local ...
INTEGER,
DIMENSION(:), POINTER :: dbcsr_row_p ...
INTEGER,
DIMENSION(:), POINTER :: dbcsr_col_i ...
INTEGER,
DIMENSION(:), POINTER :: dbcsr_row_blk_size ...
INTEGER,
DIMENSION(:), POINTER :: dbcsr_col_blk_size ...