ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
hsolver::LinearWorkspace< T, Device > Class Template Reference

Reusable device arrays and collective block algebra for linear solvers. More...

#include <linear_workspace.h>

Collaboration diagram for hsolver::LinearWorkspace< T, Device >:

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_

Detailed Description

template<typename T, typename Device>
class hsolver::LinearWorkspace< T, Device >

Reusable device arrays and collective block algebra for linear solvers.

Constructor & Destructor Documentation

◆ LinearWorkspace()

template<typename T, typename Device>
hsolver::LinearWorkspace< T, Device >::LinearWorkspace ( const diag_comm_info & comm,
int slots )

Allocate only the recurrence slots required by the calling solver.

Member Function Documentation

◆ apply()

template<typename T, typename Device>
void hsolver::LinearWorkspace< T, Device >::apply ( const LinearOperator< T, Device > & op,
const T * x,
T * y,
int ld,
int nvec )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ batch()

template<typename T, typename Device>
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.

Here is the call graph for this function:

◆ bicg_update()

template<typename T, typename Device>
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.

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

◆ cgs_alpha()

template<typename T, typename Device>
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 )
Here is the call graph for this function:

◆ cgs_direction()

template<typename T, typename Device>
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 )
Here is the call graph for this function:

◆ cgs_finish()

template<typename T, typename Device>
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.

Here is the call graph for this function:

◆ clear()

template<typename T, typename Device>
void hsolver::LinearWorkspace< T, Device >::clear ( )

Initialize recurrence storage once per cycle, including padding.

Here is the call graph for this function:

◆ copy()

template<typename T, typename Device>
void hsolver::LinearWorkspace< T, Device >::copy ( const int ld,
const int dim,
const int nvec,
const T * x,
T * y ) const

◆ data()

template<typename T, typename Device>
T * hsolver::LinearWorkspace< T, Device >::data ( const int slot)
Here is the caller graph for this function:

◆ dot()

template<typename T, typename Device>
void hsolver::LinearWorkspace< T, Device >::dot ( const int ld,
const int dim,
const int nvec,
const T * x,
const T * y,
T * out )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dot_pair()

template<typename T, typename Device>
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.

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

◆ gmres_update()

template<typename T, typename Device>
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.

Here is the call graph for this function:

◆ prepare()

template<typename T, typename Device>
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 )

◆ reset_statistics()

template<typename T, typename Device>
void hsolver::LinearWorkspace< T, Device >::reset_statistics ( )

◆ residual()

template<typename T, typename Device>
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 )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ restore()

template<typename T, typename Device>
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.

Here is the call graph for this function:

◆ statistics()

template<typename T, typename Device>
void hsolver::LinearWorkspace< T, Device >::statistics ( LinearSolveResult * result) const

◆ swap_columns()

template<typename T, typename Device>
void hsolver::LinearWorkspace< T, Device >::swap_columns ( int ld,
int dim,
const std::vector< int > & pairs )

Reorder solver columns after host convergence decisions.

Here is the call graph for this function:

◆ swap_vectors()

template<typename T, typename Device>
void hsolver::LinearWorkspace< T, Device >::swap_vectors ( int ld,
int dim,
int slots,
int stride,
T * vectors,
const std::vector< int > & pairs )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verify()

template<typename T, typename Device>
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 )
Here is the call graph for this function:

Member Data Documentation

◆ capacity_

template<typename T, typename Device>
int hsolver::LinearWorkspace< T, Device >::capacity_ = 0
private

◆ coefficients_

template<typename T, typename Device>
ct::Tensor hsolver::LinearWorkspace< T, Device >::coefficients_
private

◆ comm_

template<typename T, typename Device>
const diag_comm_info hsolver::LinearWorkspace< T, Device >::comm_
private

◆ dots_

template<typename T, typename Device>
ct::Tensor hsolver::LinearWorkspace< T, Device >::dots_
private

◆ host_coefficients_

template<typename T, typename Device>
std::vector<T> hsolver::LinearWorkspace< T, Device >::host_coefficients_
private

◆ host_dots_

template<typename T, typename Device>
std::vector<T> hsolver::LinearWorkspace< T, Device >::host_dots_
private

◆ mask_

template<typename T, typename Device>
ct::Tensor hsolver::LinearWorkspace< T, Device >::mask_
private

◆ operator_calls_

template<typename T, typename Device>
std::int64_t hsolver::LinearWorkspace< T, Device >::operator_calls_ = 0
private

◆ operator_columns_

template<typename T, typename Device>
std::int64_t hsolver::LinearWorkspace< T, Device >::operator_columns_ = 0
private

◆ partial_

template<typename T, typename Device>
ct::Tensor hsolver::LinearWorkspace< T, Device >::partial_
private

◆ permutation_

template<typename T, typename Device>
ct::Tensor hsolver::LinearWorkspace< T, Device >::permutation_
private

◆ slots_

template<typename T, typename Device>
const int hsolver::LinearWorkspace< T, Device >::slots_
private

◆ vectors_

template<typename T, typename Device>
ct::Tensor hsolver::LinearWorkspace< T, Device >::vectors_
private

The documentation for this class was generated from the following files: