PARALUTION  1.0.0
PARALUTION
gpu_matrix_hyb.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_GPU_MATRIX_HYB_HPP_
2 #define PARALUTION_GPU_MATRIX_HYB_HPP_
3 
4 #include "../base_matrix.hpp"
5 #include "../base_vector.hpp"
6 #include "../matrix_formats.hpp"
7 
8 namespace paralution {
9 
10 template <typename ValueType>
11 class GPUAcceleratorMatrixHYB : public GPUAcceleratorMatrix<ValueType> {
12 
13 public:
14 
16  GPUAcceleratorMatrixHYB(const Paralution_Backend_Descriptor local_backend);
17  virtual ~GPUAcceleratorMatrixHYB();
18 
19  inline int get_ell_max_row(void) const { return this->mat_.ELL.max_row; }
20  inline int get_ell_nnz(void) const { return this->ell_nnz_; }
21  inline int get_coo_nnz(void) const { return this->coo_nnz_; }
22 
23  virtual void info(void) const;
24  virtual unsigned int get_mat_format(void) const { return HYB; }
25 
26  virtual void Clear(void);
27  virtual void AllocateHYB(const int ell_nnz, const int coo_nnz, const int ell_max_row,
28  const int nrow, const int ncol);
29 
30  virtual bool ConvertFrom(const BaseMatrix<ValueType> &mat);
31 
32  virtual void CopyFrom(const BaseMatrix<ValueType> &mat);
33  virtual void CopyFromAsync(const BaseMatrix<ValueType> &mat);
34  virtual void CopyTo(BaseMatrix<ValueType> *mat) const;
35  virtual void CopyToAsync(BaseMatrix<ValueType> *mat) const;
36 
37  virtual void CopyFromHost(const HostMatrix<ValueType> &src);
38  virtual void CopyFromHostAsync(const HostMatrix<ValueType> &src);
39  virtual void CopyToHost(HostMatrix<ValueType> *dst) const;
40  virtual void CopyToHostAsync(HostMatrix<ValueType> *dst) const;
41 
42  virtual void Apply(const BaseVector<ValueType> &in, BaseVector<ValueType> *out) const;
43  virtual void ApplyAdd(const BaseVector<ValueType> &in, const ValueType scalar,
44  BaseVector<ValueType> *out) const;
45 
46 private:
47 
49  int ell_nnz_;
50  int coo_nnz_;
51 
52  friend class BaseVector<ValueType>;
53  friend class AcceleratorVector<ValueType>;
54  friend class GPUAcceleratorVector<ValueType>;
55 
56 };
57 
58 
59 }
60 
61 #endif // PARALUTION_GPU_MATRIX_HYB_HPP_
int ell_nnz_
Definition: gpu_matrix_hyb.hpp:49
virtual void CopyToAsync(BaseMatrix< ValueType > *mat) const
Copy to another matrix.
Definition: matrix_formats.hpp:27
virtual void CopyFrom(const BaseMatrix< ValueType > &mat)
Copy from another matrix.
virtual unsigned int get_mat_format(void) const
Return the matrix format id (see matrix_formats.hpp)
Definition: gpu_matrix_hyb.hpp:24
virtual void ApplyAdd(const BaseVector< ValueType > &in, const ValueType scalar, BaseVector< ValueType > *out) const
Apply and add the matrix to vector, out = out + scalar*this*in;.
Index max_row
Maximal elements per row.
Definition: matrix_formats.hpp:98
Definition: backend_manager.hpp:10
virtual void info(void) const
Shows simple info about the object.
Definition: base_vector.hpp:16
const IndexType const IndexType const IndexType const ValueType const ValueType scalar
Definition: cuda_kernels_coo.hpp:91
virtual void CopyFromHost(const HostMatrix< ValueType > &src)
Copy (accelerator matrix) from host matrix.
virtual void Clear(void)
Clear (free) the matrix.
int get_ell_nnz(void) const
Definition: gpu_matrix_hyb.hpp:20
virtual void CopyFromAsync(const BaseMatrix< ValueType > &mat)
Async copy from another matrix.
MatrixHYB< ValueType, int > mat_
Definition: gpu_matrix_hyb.hpp:48
virtual void CopyToHost(HostMatrix< ValueType > *dst) const
Copy (accelerator matrix) to host matrix.
virtual bool ConvertFrom(const BaseMatrix< ValueType > &mat)
Convert the matrix from another matrix (with different structure)
int get_coo_nnz(void) const
Definition: gpu_matrix_hyb.hpp:21
virtual void AllocateHYB(const int ell_nnz, const int coo_nnz, const int ell_max_row, const int nrow, const int ncol)
Allocate HYB Matrix.
Base class for all host/accelerator matrices.
Definition: base_matrix.hpp:92
int get_ell_max_row(void) const
Definition: gpu_matrix_hyb.hpp:19
Definition: backend_manager.cpp:43
virtual void CopyTo(BaseMatrix< ValueType > *mat) const
Copy to another matrix.
Definition: backend_manager.hpp:14
virtual void CopyToHostAsync(HostMatrix< ValueType > *dst) const
Async opy (accelerator matrix) to host matrix.
int coo_nnz_
Definition: gpu_matrix_hyb.hpp:50
Base class for all host/accelerator vectors.
Definition: base_vector.hpp:26
MatrixELL< ValueType, IndexType, Index > ELL
Definition: matrix_formats.hpp:111
virtual void Apply(const BaseVector< ValueType > &in, BaseVector< ValueType > *out) const
Apply the matrix to vector, out = this*in;.
virtual void CopyFromHostAsync(const HostMatrix< ValueType > &src)
Async copy (accelerator matrix) from host matrix.