Loading...
Searching...
No Matches
q3::execution::gpu::blas::GPUBLAS Class Referenceabstract

#include <init.hpp>

+ Inheritance diagram for q3::execution::gpu::blas::GPUBLAS:

Public Member Functions

 GPUBLAS (std::shared_ptr< device::GPUDeviceBackend > device_backend)
 
virtual ~GPUBLAS ()=default
 
virtual void axpy (int number_of_elements, Complex scaling_factor, const Complex *vector_x, Complex *vector_y) const =0
 
device::GPUDeviceBackend & device_backend ()
 
const device::GPUDeviceBackend & device_backend () const
 
virtual void dgemm (char transpose_a, char transpose_b, int m, int n, int k, Real alpha, const Real *matrix_a, int leading_dimension_a, const Real *matrix_b, int leading_dimension_b, Real beta, Real *matrix_c, int leading_dimension_c) const =0
 
virtual Complex dot_product (int number_of_elements, const Complex *vector_x, const Complex *vector_y) const =0
 
virtual ComplexSingle dot_product_single (int number_of_elements, const ComplexSingle *vector_x, const ComplexSingle *vector_y) const =0
 
virtual void gemm (char transpose_a, char transpose_b, int m, int n, int k, Complex alpha, const Complex *matrix_a, int leading_dimension_a, const Complex *matrix_b, int leading_dimension_b, Complex beta, Complex *matrix_c, int leading_dimension_c) const =0
 
virtual void gemm_single (char transpose_a, char transpose_b, int m, int n, int k, ComplexSingle alpha, const ComplexSingle *matrix_a, int leading_dimension_a, const ComplexSingle *matrix_b, int leading_dimension_b, ComplexSingle beta, ComplexSingle *matrix_c, int leading_dimension_c) const =0
 
virtual double norm (int number_of_elements, const Complex *vector_x) const =0
 
virtual float norm_single (int number_of_elements, const ComplexSingle *vector_x) const =0
 
virtual void scale (int number_of_elements, Complex scaling_factor, Complex *vector_x) const =0
 

Protected Attributes

std::shared_ptr< device::GPUDeviceBackend > device_backend_
 

Detailed Description

Definition at line 33 of file init.hpp.

Constructor & Destructor Documentation

◆ GPUBLAS()

q3::execution::gpu::blas::GPUBLAS::GPUBLAS ( std::shared_ptr< device::GPUDeviceBackend >  device_backend)
inlineexplicit

Construct a GPU BLAS wrapper backed by the given device.

The device backend is used for synchronization. The concrete vendor BLAS handle (cuBLAS, Accelerate) is created internally by the vendor-specific subclass constructor.

Parameters
device_backendShared pointer to the GPU device backend. Must not be null.

Definition at line 45 of file init.hpp.

◆ ~GPUBLAS()

virtual q3::execution::gpu::blas::GPUBLAS::~GPUBLAS ( )
virtualdefault

Member Function Documentation

◆ axpy()

virtual void q3::execution::gpu::blas::GPUBLAS::axpy ( int  number_of_elements,
Complex  scaling_factor,
const Complex *  vector_x,
Complex *  vector_y 
) const
pure virtual

Scaled vector addition: vector_y += scaling_factor * vector_x (ZAXPY).

Parameters
number_of_elementsLength of both vectors.
scaling_factorComplex scaling coefficient.
vector_xSource vector.
vector_yDestination vector (modified in-place).

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

Referenced by q3::execution::PlanewaveGPUExecutionPolicy::add_scaled_vector().

◆ device_backend() [1/2]

device::GPUDeviceBackend & q3::execution::gpu::blas::GPUBLAS::device_backend ( )
inline

Access the underlying GPU device backend.

Definition at line 200 of file init.hpp.

References device_backend_.

◆ device_backend() [2/2]

const device::GPUDeviceBackend & q3::execution::gpu::blas::GPUBLAS::device_backend ( ) const
inline

Access the underlying GPU device backend (const).

Definition at line 207 of file init.hpp.

References device_backend_.

◆ dgemm()

virtual void q3::execution::gpu::blas::GPUBLAS::dgemm ( char  transpose_a,
char  transpose_b,
int  m,
int  n,
int  k,
Real  alpha,
const Real *  matrix_a,
int  leading_dimension_a,
const Real *  matrix_b,
int  leading_dimension_b,
Real  beta,
Real *  matrix_c,
int  leading_dimension_c 
) const
pure virtual

Real double-precision general matrix-matrix multiply (DGEMM). matrix_c := alpha * op(matrix_a) * op(matrix_b) + beta * matrix_c

Used in gamma-only calculations where wavefunctions are real-valued.

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

Referenced by q3::GPUPlanewaveSubspaceManager::orthogonalize_batch(), and q3::GPUPlanewaveSubspaceManager::update_subspace_matrices().

◆ dot_product()

virtual Complex q3::execution::gpu::blas::GPUBLAS::dot_product ( int  number_of_elements,
const Complex *  vector_x,
const Complex *  vector_y 
) const
pure virtual

Complex double-precision conjugated dot product: result = x† · y.

Synchronizes before returning the scalar result.

Parameters
number_of_elementsLength of both vectors.
vector_xLeft operand (conjugated).
vector_yRight operand.
Returns
The complex dot product.

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

Referenced by q3::execution::PlanewaveGPUExecutionPolicy::dot_product(), and q3::cli::validate_gpu_blas().

◆ dot_product_single()

virtual ComplexSingle q3::execution::gpu::blas::GPUBLAS::dot_product_single ( int  number_of_elements,
const ComplexSingle *  vector_x,
const ComplexSingle *  vector_y 
) const
pure virtual

Complex single-precision conjugated dot product: result = x† · y.

Synchronizes before returning the scalar result.

Parameters
number_of_elementsLength of both vectors.
vector_xLeft operand (conjugated).
vector_yRight operand.
Returns
The complex single-precision dot product.

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

◆ gemm()

virtual void q3::execution::gpu::blas::GPUBLAS::gemm ( char  transpose_a,
char  transpose_b,
int  m,
int  n,
int  k,
Complex  alpha,
const Complex *  matrix_a,
int  leading_dimension_a,
const Complex *  matrix_b,
int  leading_dimension_b,
Complex  beta,
Complex *  matrix_c,
int  leading_dimension_c 
) const
pure virtual

Complex double-precision general matrix-matrix multiply (ZGEMM). matrix_c := alpha * op(matrix_a) * op(matrix_b) + beta * matrix_c

Parameters
transpose_a'N', 'T', or 'C' for op(matrix_a).
transpose_b'N', 'T', or 'C' for op(matrix_b).
mNumber of rows of op(matrix_a) and matrix_c.
nNumber of columns of op(matrix_b) and matrix_c.
kNumber of columns of op(matrix_a) / rows of op(matrix_b).
alphaScalar multiplier for the product.
matrix_aPointer to matrix A data.
leading_dimension_aLeading dimension of matrix_a.
matrix_bPointer to matrix B data.
leading_dimension_bLeading dimension of matrix_b.
betaScalar multiplier for matrix_c.
matrix_cPointer to matrix C data (in-out).
leading_dimension_cLeading dimension of matrix_c.

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

Referenced by q3::GPUPlanewaveSubspaceManager::build_correction_vectors(), q3::GPUPlanewaveSubspaceManager::collapse_subspace(), q3::GPUPlanewaveSubspaceManager::extract_eigenvectors(), q3::GPUPlanewaveSubspaceManager::orthogonalize_batch(), and q3::GPUPlanewaveSubspaceManager::update_subspace_matrices().

◆ gemm_single()

virtual void q3::execution::gpu::blas::GPUBLAS::gemm_single ( char  transpose_a,
char  transpose_b,
int  m,
int  n,
int  k,
ComplexSingle  alpha,
const ComplexSingle *  matrix_a,
int  leading_dimension_a,
const ComplexSingle *  matrix_b,
int  leading_dimension_b,
ComplexSingle  beta,
ComplexSingle *  matrix_c,
int  leading_dimension_c 
) const
pure virtual

Complex single-precision general matrix-matrix multiply (CGEMM). matrix_c := alpha * op(matrix_a) * op(matrix_b) + beta * matrix_c

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

◆ norm()

virtual double q3::execution::gpu::blas::GPUBLAS::norm ( int  number_of_elements,
const Complex *  vector_x 
) const
pure virtual

Euclidean norm of a complex double-precision vector.

Synchronizes before returning the scalar result.

Parameters
number_of_elementsLength of the vector.
vector_xInput vector.
Returns
The real-valued norm.

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

Referenced by q3::execution::PlanewaveGPUExecutionPolicy::norm().

◆ norm_single()

virtual float q3::execution::gpu::blas::GPUBLAS::norm_single ( int  number_of_elements,
const ComplexSingle *  vector_x 
) const
pure virtual

Euclidean norm of a complex single-precision vector.

Synchronizes before returning the scalar result.

Parameters
number_of_elementsLength of the vector.
vector_xInput vector.
Returns
The real-valued norm (float).

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

◆ scale()

virtual void q3::execution::gpu::blas::GPUBLAS::scale ( int  number_of_elements,
Complex  scaling_factor,
Complex *  vector_x 
) const
pure virtual

Scale a complex double-precision vector: vector_x := scaling_factor * vector_x.

Parameters
number_of_elementsLength of the vector.
scaling_factorComplex scaling coefficient.
vector_xVector to scale (in-place).

Implemented in q3::execution::gpu::blas::CudaGPUBLAS, q3::execution::gpu::blas::HIPGPUBLAS, and q3::execution::gpu::blas::SYCLGPUBLAS.

Referenced by q3::GPUPlanewaveSubspaceManager::build_correction_vectors().

Member Data Documentation

◆ device_backend_

std::shared_ptr<device::GPUDeviceBackend> q3::execution::gpu::blas::GPUBLAS::device_backend_
protected

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