|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Reusable device arrays and collective block algebra for linear solvers. More...
#include <linear_workspace.h>
Public Member Functions | |
| LinearWorkspace (const diag_comm_info &comm, int slots) | |
| Allocate only the recurrence slots required by the calling solver. | |
| void | prepare (const int ld, const int dim, const int nvec, const T *x, const T *b, const double tolerance, const int max_iter) |
| void | clear () |
| Initialize recurrence storage once per cycle, including padding. | |
| void | reset_statistics () |
| void | statistics (LinearSolveResult *result) const |
| void | swap_vectors (int ld, int dim, int slots, int stride, T *vectors, const std::vector< int > &pairs) |
| void | apply (const LinearOperator< T, Device > &op, const T *x, T *y, int ld, int nvec) |
| void | cgs_direction (int ld, int dim, int nvec, T *p, T *u, const T *r, const T *q, const T *beta) |
| void | cgs_alpha (int ld, int dim, int nvec, T *q, T *direction, const T *u, const T *v, const T *alpha) |
| void | cgs_finish (int ld, int dim, int nvec, T *x, T *r, const T *direction, const T *ad) |
| Finish the CGS step using the coefficients uploaded by cgs_alpha. | |
| T * | data (const int slot) |
| void | dot (const int ld, const int dim, const int nvec, const T *x, const T *y, T *out) |
| void | dot_pair (int ld, int dim, int nvec, const T *x, const T *y, const T *z, const T *w, T *first, T *second) |
| Return two packed global inner products in a single collective. | |
| void | batch (int ld, int dim, int nvec, T *out, const T *x, const T *y, T a, T b, const T *ca, const T *cb, const int *skip) |
| Upload per-column coefficients and update all unmasked columns. | |
| void | gmres_update (int ld, int dim, int nvec, T *solution, T *residual, const T *direction, const T *image, const T *coefficients, bool has_zero_coefficients) |
| Upload coefficients once; the caller reports zeros to select the GPU update path. | |
| void | swap_columns (int ld, int dim, const std::vector< int > &pairs) |
| Reorder solver columns after host convergence decisions. | |
| void | restore (int ld, int dim, int nvec, const std::vector< int > &order, const T *source, T *destination) |
| Restore original column order into caller storage. | |
| void | bicg_update (int ld, int dim, int nvec, bool direction, T *out, const T *x, const T *y, const T *a, const T *b) |
| Upload two coefficient arrays and execute a fused recurrence. | |
| void | copy (const int ld, const int dim, const int nvec, const T *x, T *y) const |
| void | residual (const LinearOperator< T, Device > &op, const int ld, const int dim, const int nvec, const T *x, const T *b, T *r) |
| void | verify (const LinearOperator< T, Device > &op, const int ld, const int dim, const int nvec, const T *x, const T *b, const std::vector< double > &threshold, T *scratch, LinearSolveResult *result) |
Private Attributes | |
| ct::Tensor | vectors_ |
| ct::Tensor | dots_ |
| ct::Tensor | partial_ |
| ct::Tensor | coefficients_ |
| ct::Tensor | mask_ |
| ct::Tensor | permutation_ |
| std::vector< T > | host_dots_ |
| std::vector< T > | host_coefficients_ |
| int | capacity_ = 0 |
| const int | slots_ |
| std::int64_t | operator_calls_ = 0 |
| std::int64_t | operator_columns_ = 0 |
| const diag_comm_info | comm_ |
Reusable device arrays and collective block algebra for linear solvers.
| hsolver::LinearWorkspace< T, Device >::LinearWorkspace | ( | const diag_comm_info & | comm, |
| int | slots ) |
Allocate only the recurrence slots required by the calling solver.
| void hsolver::LinearWorkspace< T, Device >::apply | ( | const LinearOperator< T, Device > & | op, |
| const T * | x, | ||
| T * | y, | ||
| int | ld, | ||
| int | nvec ) |
| void hsolver::LinearWorkspace< T, Device >::batch | ( | int | ld, |
| int | dim, | ||
| int | nvec, | ||
| T * | out, | ||
| const T * | x, | ||
| const T * | y, | ||
| T | a, | ||
| T | b, | ||
| const T * | ca, | ||
| const T * | cb, | ||
| const int * | skip ) |
Upload per-column coefficients and update all unmasked columns.
| void hsolver::LinearWorkspace< T, Device >::bicg_update | ( | int | ld, |
| int | dim, | ||
| int | nvec, | ||
| bool | direction, | ||
| T * | out, | ||
| const T * | x, | ||
| const T * | y, | ||
| const T * | a, | ||
| const T * | b ) |
Upload two coefficient arrays and execute a fused recurrence.
| void hsolver::LinearWorkspace< T, Device >::cgs_alpha | ( | int | ld, |
| int | dim, | ||
| int | nvec, | ||
| T * | q, | ||
| T * | direction, | ||
| const T * | u, | ||
| const T * | v, | ||
| const T * | alpha ) |
| void hsolver::LinearWorkspace< T, Device >::cgs_direction | ( | int | ld, |
| int | dim, | ||
| int | nvec, | ||
| T * | p, | ||
| T * | u, | ||
| const T * | r, | ||
| const T * | q, | ||
| const T * | beta ) |
| void hsolver::LinearWorkspace< T, Device >::cgs_finish | ( | int | ld, |
| int | dim, | ||
| int | nvec, | ||
| T * | x, | ||
| T * | r, | ||
| const T * | direction, | ||
| const T * | ad ) |
Finish the CGS step using the coefficients uploaded by cgs_alpha.
| void hsolver::LinearWorkspace< T, Device >::clear | ( | ) |
Initialize recurrence storage once per cycle, including padding.
| void hsolver::LinearWorkspace< T, Device >::copy | ( | const int | ld, |
| const int | dim, | ||
| const int | nvec, | ||
| const T * | x, | ||
| T * | y ) const |
| T * hsolver::LinearWorkspace< T, Device >::data | ( | const int | slot | ) |
| void hsolver::LinearWorkspace< T, Device >::dot | ( | const int | ld, |
| const int | dim, | ||
| const int | nvec, | ||
| const T * | x, | ||
| const T * | y, | ||
| T * | out ) |
| void hsolver::LinearWorkspace< T, Device >::dot_pair | ( | int | ld, |
| int | dim, | ||
| int | nvec, | ||
| const T * | x, | ||
| const T * | y, | ||
| const T * | z, | ||
| const T * | w, | ||
| T * | first, | ||
| T * | second ) |
Return two packed global inner products in a single collective.
| void hsolver::LinearWorkspace< T, Device >::gmres_update | ( | int | ld, |
| int | dim, | ||
| int | nvec, | ||
| T * | solution, | ||
| T * | residual, | ||
| const T * | direction, | ||
| const T * | image, | ||
| const T * | coefficients, | ||
| bool | has_zero_coefficients ) |
Upload coefficients once; the caller reports zeros to select the GPU update path.
| void hsolver::LinearWorkspace< T, Device >::prepare | ( | const int | ld, |
| const int | dim, | ||
| const int | nvec, | ||
| const T * | x, | ||
| const T * | b, | ||
| const double | tolerance, | ||
| const int | max_iter ) |
| void hsolver::LinearWorkspace< T, Device >::reset_statistics | ( | ) |
| void hsolver::LinearWorkspace< T, Device >::residual | ( | const LinearOperator< T, Device > & | op, |
| const int | ld, | ||
| const int | dim, | ||
| const int | nvec, | ||
| const T * | x, | ||
| const T * | b, | ||
| T * | r ) |
| void hsolver::LinearWorkspace< T, Device >::restore | ( | int | ld, |
| int | dim, | ||
| int | nvec, | ||
| const std::vector< int > & | order, | ||
| const T * | source, | ||
| T * | destination ) |
Restore original column order into caller storage.
| void hsolver::LinearWorkspace< T, Device >::statistics | ( | LinearSolveResult * | result | ) | const |
| void hsolver::LinearWorkspace< T, Device >::swap_columns | ( | int | ld, |
| int | dim, | ||
| const std::vector< int > & | pairs ) |
Reorder solver columns after host convergence decisions.
| void hsolver::LinearWorkspace< T, Device >::swap_vectors | ( | int | ld, |
| int | dim, | ||
| int | slots, | ||
| int | stride, | ||
| T * | vectors, | ||
| const std::vector< int > & | pairs ) |
| void hsolver::LinearWorkspace< T, Device >::verify | ( | const LinearOperator< T, Device > & | op, |
| const int | ld, | ||
| const int | dim, | ||
| const int | nvec, | ||
| const T * | x, | ||
| const T * | b, | ||
| const std::vector< double > & | threshold, | ||
| T * | scratch, | ||
| LinearSolveResult * | result ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |