(git:6a2e663)
cp_dbcsr_operations Module Reference

DBCSR operations in CP2K. More...

Data Types

interface  dbcsr_allocate_matrix_set
 
interface  dbcsr_deallocate_matrix_set
 

Functions/Subroutines

subroutine, public copy_fm_to_dbcsr (fm, matrix, keep_sparsity)
 Copy a BLACS matrix to a dbcsr matrix. More...
 
subroutine, public copy_fm_to_dbcsr_bc (fm, bc_mat)
 Copy a BLACS matrix to a dbcsr matrix with a special block-cyclic distribution, which requires no complete redistribution. More...
 
subroutine, public copy_dbcsr_to_fm (matrix, fm)
 Copy a DBCSR matrix to a BLACS matrix. More...
 
subroutine, public copy_dbcsr_to_fm_bc (bc_mat, fm)
 Copy a DBCSR_BLACS matrix to a BLACS matrix. More...
 
subroutine, public copy_cfm_to_dbcsr (fm, matrix, keep_sparsity)
 Copy a BLACS matrix to a dbcsr matrix. More...
 
subroutine, public copy_dbcsr_to_cfm (matrix, fm)
 Copy a DBCSR matrix to a BLACS matrix. More...
 
subroutine, public dbcsr_copy_columns_hack (matrix_b, matrix_a, ncol, source_start, target_start, para_env, blacs_env)
 hack for dbcsr_copy_columns More...
 
subroutine, public cp_dbcsr_dist2d_to_dist (dist2d, dist)
 Creates a DBCSR distribution from a distribution_2d. More...
 
subroutine, public dbcsr_multiply_local (matrix_a, vec_b, vec_c, ncol, alpha)
 multiply a dbcsr with a replicated array c = alpha_scalar * A (dbscr) * b + c More...
 
subroutine, public cp_dbcsr_sm_fm_multiply (matrix, fm_in, fm_out, ncol, alpha, beta)
 multiply a dbcsr with a fm matrix More...
 
subroutine, public cp_dbcsr_plus_fm_fm_t (sparse_matrix, matrix_v, matrix_g, ncol, alpha, keep_sparsity, symmetry_mode)
 performs the multiplication sparse_matrix+dense_mat*dens_mat^T if matrix_g is not explicitly given, matrix_v^T will be used this can be important to save the necessary redistribute for a different matrix_g and increase performance. More...
 
subroutine, public cp_fm_to_dbcsr_row_template (matrix, fm_in, template)
 Utility function to copy a specially shaped fm to dbcsr_matrix The result matrix will be the matrix in dbcsr format with the row blocks sizes according to the block_sizes of the template and the col blocks sizes evenly blocked with the internal dbcsr conversion size (32 is the current default) More...
 
subroutine, public cp_dbcsr_m_by_n_from_template (matrix, template, m, n, sym, data_type)
 Utility function to create an arbitrary shaped dbcsr matrix with the same processor grid as the template matrix both row sizes and col sizes are evenly blocked with the internal dbcsr_conversion size (32 is the current default) More...
 
subroutine, public cp_dbcsr_m_by_n_from_row_template (matrix, template, n, sym, data_type)
 Utility function to create dbcsr matrix, m x n matrix (n arbitrary) with the same processor grid and row distribution as the template matrix col sizes are evenly blocked with the internal dbcsr_conversion size (32 is the current default) More...
 
subroutine, public dbcsr_create_dist_r_unrot (dist_right, dist_left, ncolumns, right_col_blk_sizes)
 Creates a new distribution for the right matrix in a matrix multiplication with unrotated grid. More...
 

Variables

logical, parameter debug_mod = .FALSE.
 
integer, save, public max_elements_per_block = 32
 

Detailed Description

DBCSR operations in CP2K.

Author
Urban Borstnik
Date
2009-05-12
Version
0.8

Modification history:

  • Created 2009-05-12
  • Generalized sm_fm_mulitply for matrices w/ different row/col block size (A. Bussy, 11.2018)

Function/Subroutine Documentation

◆ copy_fm_to_dbcsr()

subroutine, public cp_dbcsr_operations::copy_fm_to_dbcsr ( type(cp_fm_type), intent(in)  fm,
type(dbcsr_type), intent(inout)  matrix,
logical, intent(in), optional  keep_sparsity 
)

Copy a BLACS matrix to a dbcsr matrix.

     real_matrix=beta*real_matrix+alpha*fm
     beta defaults to 0, alpha to 1
Parameters
[in]fmfull matrix
[out]matrixDBCSR matrix
[in]keep_sparsity(optional) retains the sparsity of the input matrix
Date
2009-10-13
History
2009-10-13 rewritten based on copy_dbcsr_to_fm
Author
Urban Borstnik
Version
2.0

Definition at line 117 of file cp_dbcsr_operations.F.

Here is the call graph for this function:

◆ copy_fm_to_dbcsr_bc()

subroutine, public cp_dbcsr_operations::copy_fm_to_dbcsr_bc ( type(cp_fm_type), intent(in)  fm,
type(dbcsr_type), intent(inout)  bc_mat 
)

Copy a BLACS matrix to a dbcsr matrix with a special block-cyclic distribution, which requires no complete redistribution.

Parameters
fm...
bc_mat...

Definition at line 142 of file cp_dbcsr_operations.F.

Here is the caller graph for this function:

◆ copy_dbcsr_to_fm()

subroutine, public cp_dbcsr_operations::copy_dbcsr_to_fm ( type(dbcsr_type), intent(in)  matrix,
type(cp_fm_type), intent(in)  fm 
)

Copy a DBCSR matrix to a BLACS matrix.

Parameters
[in]matrixDBCSR matrix
[out]fmfull matrix

Definition at line 207 of file cp_dbcsr_operations.F.

Here is the call graph for this function:

◆ copy_dbcsr_to_fm_bc()

subroutine, public cp_dbcsr_operations::copy_dbcsr_to_fm_bc ( type(dbcsr_type), intent(in)  bc_mat,
type(cp_fm_type), intent(in)  fm 
)

Copy a DBCSR_BLACS matrix to a BLACS matrix.

Parameters
bc_matDBCSR matrix
[out]fmfull matrix

Definition at line 269 of file cp_dbcsr_operations.F.

Here is the caller graph for this function:

◆ copy_cfm_to_dbcsr()

subroutine, public cp_dbcsr_operations::copy_cfm_to_dbcsr ( type(cp_cfm_type), intent(in)  fm,
type(dbcsr_type), intent(inout)  matrix,
logical, intent(in), optional  keep_sparsity 
)

Copy a BLACS matrix to a dbcsr matrix.

     real_matrix=beta*real_matrix+alpha*fm
     beta defaults to 0, alpha to 1
Parameters
[in]fmfull matrix
[out]matrixDBCSR matrix
[in]keep_sparsity(optional) retains the sparsity of the input matrix
Date
2009-10-13
History
2009-10-13 rewritten based on copy_dbcsr_to_fm
Author
Urban Borstnik
Version
2.0

Definition at line 318 of file cp_dbcsr_operations.F.

Here is the caller graph for this function:

◆ copy_dbcsr_to_cfm()

subroutine, public cp_dbcsr_operations::copy_dbcsr_to_cfm ( type(dbcsr_type), intent(in)  matrix,
type(cp_cfm_type), intent(in)  fm 
)

Copy a DBCSR matrix to a BLACS matrix.

Parameters
[in]matrixDBCSR matrix
[out]fmfull matrix

Definition at line 407 of file cp_dbcsr_operations.F.

Here is the caller graph for this function:

◆ dbcsr_copy_columns_hack()

subroutine, public cp_dbcsr_operations::dbcsr_copy_columns_hack ( type(dbcsr_type), intent(inout)  matrix_b,
type(dbcsr_type), intent(in)  matrix_a,
integer, intent(in)  ncol,
integer, intent(in)  source_start,
integer, intent(in)  target_start,
type(mp_para_env_type), pointer  para_env,
type(cp_blacs_env_type), pointer  blacs_env 
)

hack for dbcsr_copy_columns

Parameters
matrix_b...
matrix_a...
ncol...
source_start...
target_start...
para_env...
blacs_env...
Author
vw

Definition at line 565 of file cp_dbcsr_operations.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_dbcsr_dist2d_to_dist()

subroutine, public cp_dbcsr_operations::cp_dbcsr_dist2d_to_dist ( type(distribution_2d_type), intent(in), target  dist2d,
type(dbcsr_distribution_type), intent(out)  dist 
)

Creates a DBCSR distribution from a distribution_2d.

Parameters
[in]dist2ddistribution_2d
[out]distDBCSR distribution
History
move form dbcsr_operation 01.2010

Definition at line 610 of file cp_dbcsr_operations.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbcsr_multiply_local()

subroutine, public cp_dbcsr_operations::dbcsr_multiply_local ( type(dbcsr_type), intent(in)  matrix_a,
real(dp), dimension(:, :), intent(in)  vec_b,
real(dp), dimension(:, :), intent(inout)  vec_c,
integer, intent(in), optional  ncol,
real(dp), intent(in), optional  alpha 
)

multiply a dbcsr with a replicated array c = alpha_scalar * A (dbscr) * b + c

Parameters
[in]matrix_aDBSCR matrxx
[in]vec_bvectors b
[in,out]vec_cvectors c
[in]ncolnbr of columns
[in]alphaalpha

Definition at line 650 of file cp_dbcsr_operations.F.

Here is the call graph for this function:

◆ cp_dbcsr_sm_fm_multiply()

subroutine, public cp_dbcsr_operations::cp_dbcsr_sm_fm_multiply ( type(dbcsr_type), intent(in)  matrix,
type(cp_fm_type), intent(in)  fm_in,
type(cp_fm_type), intent(in)  fm_out,
integer, intent(in)  ncol,
real(dp), intent(in), optional  alpha,
real(dp), intent(in), optional  beta 
)

multiply a dbcsr with a fm matrix

For backwards compatibility with BLAS XGEMM, this routine supports the multiplication of matrices with incompatible dimensions.

Parameters
[in]matrixDBCSR matrix
fm_infull matrix
fm_outfull matrix
[in]ncolnbr of columns
[in]alphaalpha
[in]betabeta

Definition at line 743 of file cp_dbcsr_operations.F.

Here is the call graph for this function:

◆ cp_dbcsr_plus_fm_fm_t()

subroutine, public cp_dbcsr_operations::cp_dbcsr_plus_fm_fm_t ( type(dbcsr_type), intent(inout)  sparse_matrix,
type(cp_fm_type), intent(in)  matrix_v,
type(cp_fm_type), intent(in), optional  matrix_g,
integer, intent(in)  ncol,
real(kind=dp), intent(in), optional  alpha,
logical, intent(in), optional  keep_sparsity,
integer, intent(in), optional  symmetry_mode 
)

performs the multiplication sparse_matrix+dense_mat*dens_mat^T if matrix_g is not explicitly given, matrix_v^T will be used this can be important to save the necessary redistribute for a different matrix_g and increase performance.

Parameters
sparse_matrix...
matrix_v...
matrix_g...
ncol...
alpha...
keep_sparsityDetermines if the sparsity of sparse_matrix is retained by default it is TRUE
symmetry_modeThere are the following modes 1: sparse_matrix += 0.5*alpha*(v*g^T+g^T*v) (symmetric update) -1: sparse_matrix += 0.5*alpha*(v*g^T-g^T*v) (skewsymmetric update) else: sparse_matrix += alpha*v*g^T (no symmetry, default) saves some redistribution steps

Definition at line 886 of file cp_dbcsr_operations.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_fm_to_dbcsr_row_template()

subroutine, public cp_dbcsr_operations::cp_fm_to_dbcsr_row_template ( type(dbcsr_type), intent(inout)  matrix,
type(cp_fm_type), intent(in)  fm_in,
type(dbcsr_type), intent(in)  template 
)

Utility function to copy a specially shaped fm to dbcsr_matrix The result matrix will be the matrix in dbcsr format with the row blocks sizes according to the block_sizes of the template and the col blocks sizes evenly blocked with the internal dbcsr conversion size (32 is the current default)

Parameters
matrix...
fm_in...
template...

Definition at line 1069 of file cp_dbcsr_operations.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_dbcsr_m_by_n_from_template()

subroutine, public cp_dbcsr_operations::cp_dbcsr_m_by_n_from_template ( type(dbcsr_type), intent(inout)  matrix,
type(dbcsr_type), intent(inout)  template,
integer, intent(in)  m,
integer, intent(in)  n,
character, intent(in), optional  sym,
integer, intent(in), optional  data_type 
)

Utility function to create an arbitrary shaped dbcsr matrix with the same processor grid as the template matrix both row sizes and col sizes are evenly blocked with the internal dbcsr_conversion size (32 is the current default)

Parameters
matrixdbcsr matrix to be created
templatetemplate dbcsr matrix giving its mp_env
mglobal row size of output matrix
nglobal col size of output matrix
sym...
data_type...

Definition at line 1104 of file cp_dbcsr_operations.F.

Here is the caller graph for this function:

◆ cp_dbcsr_m_by_n_from_row_template()

subroutine, public cp_dbcsr_operations::cp_dbcsr_m_by_n_from_row_template ( type(dbcsr_type), intent(inout)  matrix,
type(dbcsr_type), intent(inout)  template,
integer  n,
character, optional  sym,
integer, optional  data_type 
)

Utility function to create dbcsr matrix, m x n matrix (n arbitrary) with the same processor grid and row distribution as the template matrix col sizes are evenly blocked with the internal dbcsr_conversion size (32 is the current default)

Parameters
matrixdbcsr matrix to be created
templatetemplate dbcsr matrix giving its mp_env
nglobal col size of output matrix
sym...
data_type...

Definition at line 1155 of file cp_dbcsr_operations.F.

Here is the caller graph for this function:

◆ dbcsr_create_dist_r_unrot()

subroutine, public cp_dbcsr_operations::dbcsr_create_dist_r_unrot ( type(dbcsr_distribution_type), intent(out)  dist_right,
type(dbcsr_distribution_type), intent(in)  dist_left,
integer, intent(in)  ncolumns,
integer, dimension(:), intent(out), pointer  right_col_blk_sizes 
)

Creates a new distribution for the right matrix in a matrix multiplication with unrotated grid.

Parameters
[out]dist_rightnew distribution for the right matrix
[in]dist_leftthe distribution of the left matrix
[in]ncolumnsnumber of columns in right matrix
[out]right_col_blk_sizessizes of blocks in the created column
The new row distribution for the right matrix is the same as the row
distribution of the left matrix, while the column distribution is created so that it is appropriate to the parallel environment.

Definition at line 1301 of file cp_dbcsr_operations.F.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ debug_mod

logical, parameter cp_dbcsr_operations::debug_mod = .FALSE.

Definition at line 58 of file cp_dbcsr_operations.F.

◆ max_elements_per_block

integer, save, public cp_dbcsr_operations::max_elements_per_block = 32

Definition at line 60 of file cp_dbcsr_operations.F.