PARALUTION  1.0.0
PARALUTION
gpu_matrix_dense.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_GPU_MATRIX_DENSE_HPP_
2 #define PARALUTION_GPU_MATRIX_DENSE_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 GPUAcceleratorMatrixDENSE : public GPUAcceleratorMatrix<ValueType> {
12 
13 public:
14 
16  GPUAcceleratorMatrixDENSE(const Paralution_Backend_Descriptor local_backend);
18 
19  virtual void info(void) const;
20  virtual unsigned int get_mat_format(void) const { return DENSE; }
21 
22  virtual void Clear(void);
23  virtual void AllocateDENSE(const int nrow, const int ncol);
24  virtual void SetDataPtrDENSE(ValueType **val, const int nrow, const int ncol);
25  virtual void LeaveDataPtrDENSE(ValueType **val);
26 
27  virtual bool ConvertFrom(const BaseMatrix<ValueType> &mat);
28 
29  virtual void CopyFrom(const BaseMatrix<ValueType> &mat);
30  virtual void CopyFromAsync(const BaseMatrix<ValueType> &mat);
31  virtual void CopyTo(BaseMatrix<ValueType> *mat) const;
32  virtual void CopyToAsync(BaseMatrix<ValueType> *mat) const;
33 
34  virtual void CopyFromHost(const HostMatrix<ValueType> &src);
35  virtual void CopyFromHostAsync(const HostMatrix<ValueType> &src);
36  virtual void CopyToHost(HostMatrix<ValueType> *dst) const;
37  virtual void CopyToHostAsync(HostMatrix<ValueType> *dst) const;
38 
39  virtual void Apply(const BaseVector<ValueType> &in, BaseVector<ValueType> *out) const;
40  virtual void ApplyAdd(const BaseVector<ValueType> &in, const ValueType scalar,
41  BaseVector<ValueType> *out) const;
42 
43  virtual bool MatMatMult(const BaseMatrix<ValueType> &A, const BaseMatrix<ValueType> &B);
44 
45  virtual bool ReplaceColumnVector(const int idx, const BaseVector<ValueType> &vec);
46  virtual bool ReplaceRowVector(const int idx, const BaseVector<ValueType> &vec);
47  virtual bool ExtractColumnVector(const int idx, BaseVector<ValueType> *vec) const;
48  virtual bool ExtractRowVector(const int idx, BaseVector<ValueType> *vec) const;
49 
50 private:
51 
53 
54  friend class BaseVector<ValueType>;
55  friend class AcceleratorVector<ValueType>;
56  friend class GPUAcceleratorVector<ValueType>;
57 
58 };
59 
60 
61 }
62 
63 #endif // PARALUTION_GPU_MATRIX_DENSE_HPP_
virtual void CopyFromAsync(const BaseMatrix< ValueType > &mat)
Async copy from another matrix.
A
Definition: pcg_example.m:10
virtual void Apply(const BaseVector< ValueType > &in, BaseVector< ValueType > *out) const
Apply the matrix to vector, out = this*in;.
virtual bool ExtractColumnVector(const int idx, BaseVector< ValueType > *vec) const
Extract values from a column of a matrix to a vector.
Definition: matrix_formats.hpp:20
const IndexType idx
Definition: cuda_kernels_coo.hpp:115
virtual void CopyFromHost(const HostMatrix< ValueType > &src)
Copy (accelerator matrix) from host matrix.
virtual bool ExtractRowVector(const int idx, BaseVector< ValueType > *vec) const
Extract values from a row of a matrix to a vector.
Definition: backend_manager.hpp:10
Definition: base_vector.hpp:16
Dense Matrix (see DENSE_IND for indexing)
Definition: matrix_formats.hpp:117
const IndexType const IndexType const IndexType const ValueType const ValueType scalar
Definition: cuda_kernels_coo.hpp:91
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;.
virtual bool ReplaceRowVector(const int idx, const BaseVector< ValueType > &vec)
Replace a column vector of a matrix.
virtual bool ConvertFrom(const BaseMatrix< ValueType > &mat)
Convert the matrix from another matrix (with different structure)
virtual void CopyToHostAsync(HostMatrix< ValueType > *dst) const
Async opy (accelerator matrix) to host matrix.
virtual void CopyToHost(HostMatrix< ValueType > *dst) const
Copy (accelerator matrix) to host matrix.
virtual bool ReplaceColumnVector(const int idx, const BaseVector< ValueType > &vec)
Replace a column vector of a matrix.
Base class for all host/accelerator matrices.
Definition: base_matrix.hpp:92
virtual void CopyFromHostAsync(const HostMatrix< ValueType > &src)
Async copy (accelerator matrix) from host matrix.
virtual void SetDataPtrDENSE(ValueType **val, const int nrow, const int ncol)
Initialize a DENSE matrix on the Host with externally allocated data.
Definition: backend_manager.cpp:43
virtual void info(void) const
Shows simple info about the object.
Definition: backend_manager.hpp:14
virtual void Clear(void)
Clear (free) the matrix.
virtual void CopyTo(BaseMatrix< ValueType > *mat) const
Copy to another matrix.
virtual unsigned int get_mat_format(void) const
Return the matrix format id (see matrix_formats.hpp)
Definition: gpu_matrix_dense.hpp:20
MatrixDENSE< ValueType > mat_
Definition: gpu_matrix_dense.hpp:52
virtual bool MatMatMult(const BaseMatrix< ValueType > &A, const BaseMatrix< ValueType > &B)
Multiply two matrices, this = A * B.
Base class for all host/accelerator vectors.
Definition: base_vector.hpp:26
virtual void AllocateDENSE(const int nrow, const int ncol)
Allocate DENSE Matrix.
virtual void CopyFrom(const BaseMatrix< ValueType > &mat)
Copy from another matrix.
virtual void LeaveDataPtrDENSE(ValueType **val)
Leave a DENSE matrix to Host pointers.
virtual void CopyToAsync(BaseMatrix< ValueType > *mat) const
Copy to another matrix.