imate
C++/CUDA Reference
|
Base class for linear operators. This class serves as interface for all derived classes. More...
#include <cu_linear_operator.h>
Public Member Functions | |
cuLinearOperator () | |
cuLinearOperator (int num_gpu_devices_) | |
Constructor with setting num_rows and num_columns . More... | |
virtual | ~cuLinearOperator () |
cublasHandle_t | get_cublas_handle () const |
This function returns a reference to the cublasHandle_t object. The object will be created, if it is not created already. More... | |
Public Member Functions inherited from cLinearOperator< DataType > | |
cLinearOperator () | |
Default constructor. More... | |
cLinearOperator (const LongIndexType num_rows_, const LongIndexType num_columns_) | |
Constructor with setting num_rows and num_columns . More... | |
virtual | ~cLinearOperator () |
LongIndexType | get_num_rows () const |
LongIndexType | get_num_columns () const |
void | set_parameters (DataType *parameters_) |
Sets the scalar parameter this->parameters . Parameter is initialized to NULL . However, before calling dot or transpose_dot functions, the parameters must be set. More... | |
IndexType | get_num_parameters () const |
FlagType | is_eigenvalue_relation_known () const |
Returns a flag that determines whether a relation between the parameters of the operator and its eigenvalue(s) is known. More... | |
virtual DataType | get_eigenvalue (const DataType *known_parameters, const DataType known_eigenvalue, const DataType *inquiry_parameters) const =0 |
virtual void | dot (const DataType *vector, DataType *product)=0 |
virtual void | transpose_dot (const DataType *vector, DataType *product)=0 |
Protected Member Functions | |
int | query_gpu_devices () const |
Before any numerical computation, this method chechs if any gpu device is available on the machine, or notifies the user if nothing was found. More... | |
void | initialize_cublas_handle () |
Creates a cublasHandle_t object, if not created already. More... | |
void | initialize_cusparse_handle () |
Creates a cusparseHandle_t object, if not created already. More... | |
Protected Attributes | |
int | num_gpu_devices |
bool | copied_host_to_device |
cublasHandle_t * | cublas_handle |
cusparseHandle_t * | cusparse_handle |
Protected Attributes inherited from cLinearOperator< DataType > | |
const LongIndexType | num_rows |
const LongIndexType | num_columns |
FlagType | eigenvalue_relation_known |
DataType * | parameters |
IndexType | num_parameters |
Base class for linear operators. This class serves as interface for all derived classes.
The prefix c
in this class's name (and its derivatves), stands for the cpp
code, intrast to the cu
prefix, which stands for the cuda code. Most derived classes have a cuda counterpart.
Definition at line 43 of file cu_linear_operator.h.
cuLinearOperator< DataType >::cuLinearOperator |
Definition at line 30 of file cu_linear_operator.cu.
References cuLinearOperator< DataType >::initialize_cublas_handle(), cuLinearOperator< DataType >::num_gpu_devices, and cuLinearOperator< DataType >::query_gpu_devices().
|
explicit |
Constructor with setting num_rows
and num_columns
.
Definition at line 60 of file cu_linear_operator.cu.
References cuLinearOperator< DataType >::initialize_cublas_handle(), cuLinearOperator< DataType >::num_gpu_devices, and cuLinearOperator< DataType >::query_gpu_devices().
|
virtual |
Definition at line 103 of file cu_linear_operator.cu.
References cusparseDestroy(), and CudaInterface< ArrayType >::set_device().
cublasHandle_t cuLinearOperator< DataType >::get_cublas_handle |
This function returns a reference to the cublasHandle_t
object. The object will be created, if it is not created already.
The cublasHandle
is needed for the client code (slq method) for vector operations on GPU. However, in this class, the cublasHandle_t
might not be needed by it self if the derived class is a sparse matrix, becase the sparse matrix needs only cusparseHandle_t
. In case if the cublasHandle_t
is not created, it will be created for the purpose of the client codes.
Definition at line 168 of file cu_linear_operator.cu.
References CudaInterface< ArrayType >::get_device().
Referenced by cu_golub_kahn_bidiagonalization(), and cu_lanczos_tridiagonalization().
|
protected |
Creates a cublasHandle_t
object, if not created already.
Definition at line 185 of file cu_linear_operator.cu.
References CudaInterface< ArrayType >::set_device().
Referenced by cuDenseAffineMatrixFunction< DataType >::cuDenseAffineMatrixFunction(), cuDenseMatrix< DataType >::cuDenseMatrix(), and cuLinearOperator< DataType >::cuLinearOperator().
|
protected |
Creates a cusparseHandle_t
object, if not created already.
Definition at line 217 of file cu_linear_operator.cu.
References cusparseCreate(), and CudaInterface< ArrayType >::set_device().
Referenced by cuCSCAffineMatrixFunction< DataType >::cuCSCAffineMatrixFunction(), cuCSCMatrix< DataType >::cuCSCMatrix(), cuCSRAffineMatrixFunction< DataType >::cuCSRAffineMatrixFunction(), and cuCSRMatrix< DataType >::cuCSRMatrix().
|
protected |
Before any numerical computation, this method chechs if any gpu device is available on the machine, or notifies the user if nothing was found.
Definition at line 252 of file cu_linear_operator.cu.
References cudaGetDeviceCount().
Referenced by cuLinearOperator< DataType >::cuLinearOperator().
|
protected |
Definition at line 64 of file cu_linear_operator.h.
|
protected |
Definition at line 65 of file cu_linear_operator.h.
|
protected |
Definition at line 66 of file cu_linear_operator.h.
|
protected |
Definition at line 63 of file cu_linear_operator.h.
Referenced by cuCSCMatrix< DataType >::cuCSCMatrix(), cuCSRMatrix< DataType >::cuCSRMatrix(), and cuLinearOperator< DataType >::cuLinearOperator().