![]() |
(git:27c966b)
|
Matrix-free application of the BSE matrices A and B to trial vectors from RI slabs that are sliced along the RI index over all MPI ranks. More...
Data Types | |
| type | bse_matvec_env_type |
| RI slabs of one spin channel, every rank holding n_ri_loc whole RI slices. More... | |
Functions/Subroutines | |
| subroutine, public | bse_resolve_memory_per_proc (memory_per_proc_gb, para_env, unit_nr) |
| MEMORY_PER_PROC of the BSE as a number: the keyword's value, or for -1 the memory the rank holds plus the share detected_memory_fraction of the free memory, read once at the first consumer; when the free memory cannot be read, the GW's fallback of 2 GB with a warning. | |
| real(kind=dp) function, public | bse_memory_left_gb (memory_per_proc_gb, para_env) |
| What MEMORY_PER_PROC leaves to a step: the resolved memory per MPI rank minus the memory the rank holds now, never negative; both probes reduce over the ranks, so every rank gets the same. | |
| subroutine, public | bse_matvec_create (mv_env, fm_s_ia, fm_s_bar_ij, fm_s_ab, fm_s_bar_ia, eps_reduced, homo, virt, alpha, w_fac, do_abba, unit_nr, block_cols, memory_per_proc_gb) |
| Moves the RI slabs onto an npe x 1 process grid, such that every rank owns whole RI slices, and stores them as local 3-index arrays: the contraction over each P in bse_matvec_apply is then a local DGEMM and only the final sum over P crosses the ranks. | |
| subroutine, public | bse_matvec_release (mv_env) |
| Frees the sliced slabs, the transition energies and the process grid of mv_env. | |
| subroutine, public | bse_matvec_vector_struct (mv_env, ncol_global, fm_struct) |
| Matrix structure of a block of trial vectors: rows ia distributed, all columns local. | |
| subroutine, public | bse_matvec_apply (mv_env, fm_z, first_col, ncol, fm_az, fm_bz, first_col_bz) |
| Applies A (and B) to ncol trial vectors without forming an N_ov x N_ov object, (A Z)_ia = (ε_a-ε_i) Z_ia + α sum_P B^P_ia sum_jb B^P_jb Z_jb - w sum_Pjb \bar{B}^P_ij B^P_ab Z_jb (B Z)_ia = α sum_P B^P_ia sum_jb B^P_jb Z_jb - w sum_Pjb \bar{B}^P_ib B^P_ja Z_jb α: exchange prefactor (2 singlet, 0 triplet), w: prefactor of the screened term, \bar{B}: slab bound by the caller of bse_matvec_create (B itself for TDHF and ALPHA screening, sum_Q [1+Q(0)]^-1_PQ B^Q otherwise); the sums over P run over the local RI slices and are completed by a sum over the ranks. | |
| subroutine, public | bse_matvec_diagonal (mv_env, precond_kind, diag) |
| Diagonal used by the Davidson correction, either ε_a-ε_i or the full diagonal A_ia,ia = ε_a-ε_i + α sum_P (B^P_ia)^2 - w sum_P \bar{B}^P_ii B^P_aa with α, w and \bar{B} as in bse_matvec_apply. | |
| subroutine, public | bse_matvec_subblock (mv_env, ia_list, a_sub, b_sub) |
| Exact A (and B) on a list of transitions, replicated on every rank, A_kl = δ_kl (ε_a-ε_i) + α sum_P B^P_ia B^P_jb - w sum_P \bar{B}^P_ij B^P_ab B_kl = α sum_P B^P_ia B^P_jb - w sum_P \bar{B}^P_ib B^P_ja with k = (i,a), l = (j,b) and α, w, \bar{B} as in bse_matvec_apply. | |
| subroutine, public | bse_matvec_selfcheck (mv_env, fm_a_explicit, unit_nr, fm_b_explicit) |
| Debug check of the matrix-free application against the explicit matrices A (and B), dev = max_ia,k |(A Z)_ia,k - sum_jb A_ia,jb Z_jb,k| over up to eight unit vectors Z_ia,k = δ_ia,k and one dense vector Z_ia = sin(ia), the same for B, and max_ia |d_ia - A_ia,ia| for the diagonal. | |
Matrix-free application of the BSE matrices A and B to trial vectors from RI slabs that are sliced along the RI index over all MPI ranks.
| subroutine, public bse_matvec::bse_resolve_memory_per_proc | ( | real(kind=dp), intent(inout) | memory_per_proc_gb, |
| type(mp_para_env_type), pointer | para_env, | ||
| integer, intent(in) | unit_nr ) |
MEMORY_PER_PROC of the BSE as a number: the keyword's value, or for -1 the memory the rank holds plus the share detected_memory_fraction of the free memory, read once at the first consumer; when the free memory cannot be read, the GW's fallback of 2 GB with a warning.
| memory_per_proc_gb | the keyword's value on entry, the memory per MPI rank for the BSE on exit |
| para_env | the ranks that share the node's memory |
| unit_nr | output unit, positive on the writing rank only |
Definition at line 93 of file bse_matvec.F.
| real(kind=dp) function, public bse_matvec::bse_memory_left_gb | ( | real(kind=dp), intent(in) | memory_per_proc_gb, |
| type(mp_para_env_type), pointer | para_env ) |
What MEMORY_PER_PROC leaves to a step: the resolved memory per MPI rank minus the memory the rank holds now, never negative; both probes reduce over the ranks, so every rank gets the same.
| memory_per_proc_gb | the resolved MEMORY_PER_PROC |
| para_env | the ranks that share the node's memory |
Definition at line 125 of file bse_matvec.F.
| subroutine, public bse_matvec::bse_matvec_create | ( | type(bse_matvec_env_type), intent(out) | mv_env, |
| type(cp_fm_type), intent(in) | fm_s_ia, | ||
| type(cp_fm_type), intent(in) | fm_s_bar_ij, | ||
| type(cp_fm_type), intent(in) | fm_s_ab, | ||
| type(cp_fm_type), intent(in) | fm_s_bar_ia, | ||
| real(kind=dp), dimension(:), intent(in) | eps_reduced, | ||
| integer, intent(in) | homo, | ||
| integer, intent(in) | virt, | ||
| real(kind=dp), intent(in) | alpha, | ||
| real(kind=dp), intent(in) | w_fac, | ||
| logical, intent(in) | do_abba, | ||
| integer, intent(in) | unit_nr, | ||
| integer, intent(in), optional | block_cols, | ||
| real(kind=dp), intent(in), optional | memory_per_proc_gb ) |
Moves the RI slabs onto an npe x 1 process grid, such that every rank owns whole RI slices, and stores them as local 3-index arrays: the contraction over each P in bse_matvec_apply is then a local DGEMM and only the final sum over P crosses the ranks.
| mv_env | the environment created here |
| fm_S_ia | B^P_ia, N_RI x homo*virt |
| fm_S_bar_ij | \bar{B}^P_ij, the slab that enters W_ij,ab, N_RI x homo*homo |
| fm_S_ab | B^P_ab, N_RI x virt*virt |
| fm_S_bar_ia | \bar{B}^P_ia, the slab that enters W_ib,aj, N_RI x homo*virt |
| eps_reduced | quasiparticle energies of the homo+virt active levels |
| homo | occupied levels of the active window |
| virt | virtual levels of the active window |
| alpha | prefactor of the exchange term, 2 singlet, 0 triplet |
| w_fac | prefactor of the screened term, 0 switches it off |
| do_abba | slice \bar{B}^P_ia as well, for the application of B |
| unit_nr | output unit, positive on the writing rank only |
| block_cols | trial vectors per pass of bse_matvec_apply; absent or -1 sizes it from the memory left |
| memory_per_proc_gb | the resolved MEMORY_PER_PROC of the BSE, what block_cols -1 sizes the pass from |
Definition at line 158 of file bse_matvec.F.
| subroutine, public bse_matvec::bse_matvec_release | ( | type(bse_matvec_env_type), intent(inout) | mv_env | ) |
Frees the sliced slabs, the transition energies and the process grid of mv_env.
| mv_env | the environment released |
Definition at line 326 of file bse_matvec.F.
| subroutine, public bse_matvec::bse_matvec_vector_struct | ( | type(bse_matvec_env_type), intent(in) | mv_env, |
| integer, intent(in) | ncol_global, | ||
| type(cp_fm_struct_type), pointer | fm_struct ) |
Matrix structure of a block of trial vectors: rows ia distributed, all columns local.
| mv_env | process grid and communicator of the trial vectors |
| ncol_global | number of trial vectors |
| fm_struct | created here, released by the caller |
Definition at line 348 of file bse_matvec.F.
| subroutine, public bse_matvec::bse_matvec_apply | ( | type(bse_matvec_env_type), intent(in), target | mv_env, |
| type(cp_fm_type), intent(in) | fm_z, | ||
| integer, intent(in) | first_col, | ||
| integer, intent(in) | ncol, | ||
| type(cp_fm_type), intent(in) | fm_az, | ||
| type(cp_fm_type), intent(in), optional | fm_bz, | ||
| integer, intent(in), optional | first_col_bz ) |
Applies A (and B) to ncol trial vectors without forming an N_ov x N_ov object, (A Z)_ia = (ε_a-ε_i) Z_ia + α sum_P B^P_ia sum_jb B^P_jb Z_jb - w sum_Pjb \bar{B}^P_ij B^P_ab Z_jb (B Z)_ia = α sum_P B^P_ia sum_jb B^P_jb Z_jb - w sum_Pjb \bar{B}^P_ib B^P_ja Z_jb α: exchange prefactor (2 singlet, 0 triplet), w: prefactor of the screened term, \bar{B}: slab bound by the caller of bse_matvec_create (B itself for TDHF and ALPHA screening, sum_Q [1+Q(0)]^-1_PQ B^Q otherwise); the sums over P run over the local RI slices and are completed by a sum over the ranks.
| mv_env | slabs, prefactors and transition energies |
| fm_Z | trial vectors, columns first_col .. first_col+ncol-1 are read |
| first_col | first trial vector read, and first column written |
| ncol | number of trial vectors |
| fm_AZ | receives A Z in the same columns |
| fm_BZ | receives B Z in the same columns, or from first_col_BZ on |
| first_col_BZ | first column of fm_BZ written, first_col by default |
Definition at line 379 of file bse_matvec.F.
| subroutine, public bse_matvec::bse_matvec_diagonal | ( | type(bse_matvec_env_type), intent(in) | mv_env, |
| integer, intent(in) | precond_kind, | ||
| real(kind=dp), dimension(:), intent(out) | diag ) |
Diagonal used by the Davidson correction, either ε_a-ε_i or the full diagonal A_ia,ia = ε_a-ε_i + α sum_P (B^P_ia)^2 - w sum_P \bar{B}^P_ii B^P_aa with α, w and \bar{B} as in bse_matvec_apply.
| mv_env | slabs, prefactors and transition energies |
| precond_kind | bse_precond_full_diag or bse_precond_qp_diff |
| diag | replicated, size N_ov |
Definition at line 633 of file bse_matvec.F.
| subroutine, public bse_matvec::bse_matvec_subblock | ( | type(bse_matvec_env_type), intent(in) | mv_env, |
| integer, dimension(:), intent(in) | ia_list, | ||
| real(kind=dp), dimension(:, :), intent(out) | a_sub, | ||
| real(kind=dp), dimension(:, :), intent(out), optional | b_sub ) |
Exact A (and B) on a list of transitions, replicated on every rank, A_kl = δ_kl (ε_a-ε_i) + α sum_P B^P_ia B^P_jb - w sum_P \bar{B}^P_ij B^P_ab B_kl = α sum_P B^P_ia B^P_jb - w sum_P \bar{B}^P_ib B^P_ja with k = (i,a), l = (j,b) and α, w, \bar{B} as in bse_matvec_apply.
| mv_env | slabs, prefactors and transition energies |
| ia_list | global transition indices ia = (i-1)*virt + a of the block |
| A_sub | SIZE(ia_list) x SIZE(ia_list) |
| B_sub | same, only formed when present |
Definition at line 677 of file bse_matvec.F.
| subroutine, public bse_matvec::bse_matvec_selfcheck | ( | type(bse_matvec_env_type), intent(in) | mv_env, |
| type(cp_fm_type), intent(in) | fm_a_explicit, | ||
| integer, intent(in) | unit_nr, | ||
| type(cp_fm_type), intent(in), optional | fm_b_explicit ) |
Debug check of the matrix-free application against the explicit matrices A (and B), dev = max_ia,k |(A Z)_ia,k - sum_jb A_ia,jb Z_jb,k| over up to eight unit vectors Z_ia,k = δ_ia,k and one dense vector Z_ia = sin(ia), the same for B, and max_ia |d_ia - A_ia,ia| for the diagonal.
| mv_env | the environment under test |
| fm_A_explicit | A from create_A_and_B, N_ov x N_ov on the grid of the caller |
| unit_nr | output unit, positive on the writing rank only |
| fm_B_explicit | B, present for an ABBA run |
Definition at line 752 of file bse_matvec.F.