PARALUTION  1.0.0
PARALUTION
ocl_matrix_ell.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_OCL_MATRIX_ELL_HPP_
2 #define PARALUTION_OCL_MATRIX_ELL_HPP_
3 
4 #include "../base_matrix.hpp"
5 #include "../base_vector.hpp"
6 #include "../matrix_formats.hpp"
7 
8 #if defined(__APPLE__) && defined(__MACH__)
9 #include <OpenCL/cl.h>
10 #else
11 #include <CL/cl.h>
12 #endif
13 
14 namespace paralution {
15 
16 template <class ValueType>
17 class OCLAcceleratorMatrixELL : public OCLAcceleratorMatrix<ValueType> {
18 
19 public:
20 
22  OCLAcceleratorMatrixELL(const Paralution_Backend_Descriptor local_backend);
23  virtual ~OCLAcceleratorMatrixELL();
24 
25  inline int get_max_row(void) const { return mat_.max_row; }
26 
27  virtual void info(void) const;
28  virtual unsigned int get_mat_format(void) const{ return ELL; }
29 
30  virtual void Clear(void);
31  virtual void AllocateELL(const int nnz, const int nrow, const int ncol, const int max_row);
32 
33  virtual bool ConvertFrom(const BaseMatrix<ValueType> &mat);
34 
35  virtual void CopyFrom(const BaseMatrix<ValueType> &mat);
36  virtual void CopyTo(BaseMatrix<ValueType> *mat) const;
37 
38  virtual void CopyFromHost(const HostMatrix<ValueType> &src);
39  virtual void CopyToHost(HostMatrix<ValueType> *dst) const;
40 
41  virtual void Apply(const BaseVector<ValueType> &in, BaseVector<ValueType> *out) const;
42  virtual void ApplyAdd(const BaseVector<ValueType> &in, const ValueType scalar,
43  BaseVector<ValueType> *out) const;
44 
45 private:
46 
48 
49  friend class BaseVector<ValueType>;
50  friend class AcceleratorVector<ValueType>;
51  friend class OCLAcceleratorVector<ValueType>;
52 
53 };
54 
55 
56 }
57 
58 #endif // PARALUTION_OCL_MATRIX_ELL_HPP_
virtual void CopyToHost(HostMatrix< ValueType > *dst) const
Copy (accelerator matrix) to host matrix.
Definition: ocl_matrix_ell.cpp:164
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;.
Definition: ocl_matrix_ell.cpp:531
virtual bool ConvertFrom(const BaseMatrix< ValueType > &mat)
Convert the matrix from another matrix (with different structure)
Definition: ocl_matrix_ell.cpp:317
virtual void info(void) const
Shows simple info about the object.
Definition: ocl_matrix_ell.cpp:49
Index max_row
Maximal elements per row.
Definition: matrix_formats.hpp:98
OCLAcceleratorMatrixELL()
Definition: ocl_matrix_ell.cpp:17
Definition: backend_manager.hpp:10
virtual void Apply(const BaseVector< ValueType > &in, BaseVector< ValueType > *out) const
Apply the matrix to vector, out = this*in;.
Definition: ocl_matrix_ell.cpp:468
nnz
Definition: pcg_example.m:8
const IndexType const IndexType const IndexType const ValueType const ValueType scalar
Definition: cuda_kernels_coo.hpp:91
int get_max_row(void) const
Definition: ocl_matrix_ell.hpp:25
virtual void CopyFromHost(const HostMatrix< ValueType > &src)
Copy (accelerator matrix) from host matrix.
Definition: ocl_matrix_ell.cpp:121
virtual unsigned int get_mat_format(void) const
Return the matrix format id (see matrix_formats.hpp)
Definition: ocl_matrix_ell.hpp:28
virtual void CopyTo(BaseMatrix< ValueType > *mat) const
Copy to another matrix.
Definition: ocl_matrix_ell.cpp:262
MatrixELL< cl_mem, cl_mem, int > mat_
Definition: ocl_matrix_ell.hpp:47
virtual void Clear(void)
Clear (free) the matrix.
Definition: ocl_matrix_ell.cpp:105
virtual void CopyFrom(const BaseMatrix< ValueType > &mat)
Copy from another matrix.
Definition: ocl_matrix_ell.cpp:209
Base class for all host/accelerator matrices.
Definition: base_matrix.hpp:92
virtual ~OCLAcceleratorMatrixELL()
Definition: ocl_matrix_ell.cpp:39
virtual void AllocateELL(const int nnz, const int nrow, const int ncol, const int max_row)
Allocate ELL Matrix.
Definition: ocl_matrix_ell.cpp:56
Definition: backend_manager.cpp:43
Definition: backend_manager.hpp:14
Definition: matrix_formats.hpp:26
Definition: base_vector.hpp:19
Base class for all host/accelerator vectors.
Definition: base_vector.hpp:26