imate
C++/CUDA Reference
|
#include <cu_csc_matrix.h>
Public Member Functions | |
cuCSCMatrix () | |
Default constructor. More... | |
cuCSCMatrix (const DataType *A_data_, const LongIndexType *A_indices_, const LongIndexType *A_index_pointer_, const LongIndexType num_rows_, const LongIndexType num_columns_, const int num_gpu_devices_) | |
Constructor with arguments. More... | |
virtual | ~cuCSCMatrix () |
Virtual desructor. More... | |
virtual void | dot (const DataType *device_vector, DataType *device_product) |
virtual void | dot_plus (const DataType *device_vector, const DataType alpha, DataType *device_product) |
virtual void | transpose_dot (const DataType *device_vector, DataType *device_product) |
virtual void | transpose_dot_plus (const DataType *device_vector, const DataType alpha, DataType *device_product) |
Public Member Functions inherited from cuMatrix< DataType > | |
cuMatrix () | |
cuMatrix (int num_gpu_devices_) | |
virtual | ~cuMatrix () |
Public Member Functions inherited from cuLinearOperator< DataType > | |
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... | |
Public Member Functions inherited from cCSCMatrix< DataType > | |
cCSCMatrix () | |
cCSCMatrix (const DataType *A_data_, const LongIndexType *A_indices_, const LongIndexType *A_index_pointer_, const LongIndexType num_rows_, const LongIndexType num_columns_) | |
virtual | ~cCSCMatrix () |
virtual FlagType | is_identity_matrix () const |
Checks whether the matrix is identity. More... | |
LongIndexType | get_nnz () const |
Returns the number of non-zero elements of the sparse matrix. More... | |
Public Member Functions inherited from cMatrix< DataType > | |
cMatrix () | |
Default constructor. More... | |
virtual | ~cMatrix () |
DataType | get_eigenvalue (const DataType *known_parameters, const DataType known_eigenvalue, const DataType *inquiry_parameters) const |
This virtual function is implemented from its pure virtual function of the base class. In this class, this functio has no use and was only implemented so that this class be able to be instantiated (due to the pure virtual function). More... | |
Protected Member Functions | |
virtual void | copy_host_to_device () |
Copies the member data from the host memory to the device memory. More... | |
void | allocate_buffer (const int device_id, cusparseOperation_t cusparse_operation, const DataType alpha, const DataType beta, cusparseDnVecDescr_t &cusparse_input_vector, cusparseDnVecDescr_t &cusparse_output_vector, cusparseSpMVAlg_t algorithm) |
Allocates an external buffer for matrix-vector multiplication using cusparseSpMV function. More... | |
Protected Member Functions inherited from cuLinearOperator< DataType > | |
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 | |
DataType ** | device_A_data |
LongIndexType ** | device_A_indices |
LongIndexType ** | device_A_index_pointer |
void ** | device_buffer |
size_t * | device_buffer_num_bytes |
cusparseSpMatDescr_t * | cusparse_matrix_A |
Protected Attributes inherited from cuLinearOperator< DataType > | |
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 |
Protected Attributes inherited from cCSCMatrix< DataType > | |
const DataType * | A_data |
const LongIndexType * | A_indices |
const LongIndexType * | A_index_pointer |
Definition at line 30 of file cu_csc_matrix.h.
cuCSCMatrix< DataType >::cuCSCMatrix |
Default constructor.
Definition at line 33 of file cu_csc_matrix.cu.
cuCSCMatrix< DataType >::cuCSCMatrix | ( | const DataType * | A_data_, |
const LongIndexType * | A_indices_, | ||
const LongIndexType * | A_index_pointer_, | ||
const LongIndexType | num_rows_, | ||
const LongIndexType | num_columns_, | ||
const int | num_gpu_devices_ | ||
) |
Constructor with arguments.
Definition at line 52 of file cu_csc_matrix.cu.
References cuCSCMatrix< DataType >::copy_host_to_device(), cuCSCMatrix< DataType >::device_buffer, cuCSCMatrix< DataType >::device_buffer_num_bytes, cuLinearOperator< DataType >::initialize_cusparse_handle(), and cuLinearOperator< DataType >::num_gpu_devices.
|
virtual |
Virtual desructor.
Definition at line 95 of file cu_csc_matrix.cu.
References CudaInterface< ArrayType >::del(), cusparse_interface::destroy_cusparse_matrix(), and CudaInterface< ArrayType >::set_device().
|
protected |
Allocates an external buffer for matrix-vector multiplication using cusparseSpMV
function.
If buffer size if not the same as required buffer size, allocate (or reallocate) memory. The allocation is always performed in the first call of this function since buffer size is initialized to zero in constructor. But for the next calls it might not be reallocated if the buffer size is the same.
Definition at line 250 of file cu_csc_matrix.cu.
References CudaInterface< ArrayType >::alloc_bytes(), cusparse_interface::cusparse_matrix_buffer_size(), and CudaInterface< ArrayType >::del().
|
protectedvirtual |
Copies the member data from the host memory to the device memory.
Implements cuMatrix< DataType >.
Definition at line 169 of file cu_csc_matrix.cu.
References CudaInterface< ArrayType >::alloc(), CudaInterface< ArrayType >::copy_to_device(), cusparse_interface::create_cusparse_matrix(), and CudaInterface< ArrayType >::set_device().
Referenced by cuCSCMatrix< DataType >::cuCSCMatrix().
|
virtual |
Reimplemented from cCSCMatrix< DataType >.
Definition at line 287 of file cu_csc_matrix.cu.
References cusparse_interface::create_cusparse_vector(), cusparse_interface::cusparse_matvec(), CUSPARSE_SPMV_ALG_DEFAULT, cusparse_interface::destroy_cusparse_vector(), and CudaInterface< ArrayType >::get_device().
|
virtual |
Reimplemented from cCSCMatrix< DataType >.
Definition at line 337 of file cu_csc_matrix.cu.
References cusparse_interface::create_cusparse_vector(), cusparse_interface::cusparse_matvec(), CUSPARSE_SPMV_ALG_DEFAULT, cusparse_interface::destroy_cusparse_vector(), and CudaInterface< ArrayType >::get_device().
|
virtual |
Reimplemented from cCSCMatrix< DataType >.
Definition at line 387 of file cu_csc_matrix.cu.
References cusparse_interface::create_cusparse_vector(), cusparse_interface::cusparse_matvec(), CUSPARSE_SPMV_ALG_DEFAULT, cusparse_interface::destroy_cusparse_vector(), and CudaInterface< ArrayType >::get_device().
|
virtual |
Reimplemented from cCSCMatrix< DataType >.
Definition at line 437 of file cu_csc_matrix.cu.
References cusparse_interface::create_cusparse_vector(), cusparse_interface::cusparse_matvec(), CUSPARSE_SPMV_ALG_DEFAULT, cusparse_interface::destroy_cusparse_vector(), and CudaInterface< ArrayType >::get_device().
|
protected |
Definition at line 87 of file cu_csc_matrix.h.
|
protected |
Definition at line 82 of file cu_csc_matrix.h.
|
protected |
Definition at line 84 of file cu_csc_matrix.h.
|
protected |
Definition at line 83 of file cu_csc_matrix.h.
|
protected |
Definition at line 85 of file cu_csc_matrix.h.
Referenced by cuCSCMatrix< DataType >::cuCSCMatrix().
|
protected |
Definition at line 86 of file cu_csc_matrix.h.
Referenced by cuCSCMatrix< DataType >::cuCSCMatrix().