PARALUTION  1.0.0
PARALUTION
ocl_matrix_coo.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_OCL_MATRIX_COO_HPP_
2 #define PARALUTION_OCL_MATRIX_COO_HPP_
3 
4 #include "../base_matrix.hpp"
5 #include "../base_vector.hpp"
6 
7 #if defined(__APPLE__) && defined(__MACH__)
8 #include <OpenCL/cl.h>
9 #else
10 #include <CL/cl.h>
11 #endif
12 
13 namespace paralution {
14 
15 template <class ValueType>
16 class OCLAcceleratorMatrixCOO : public OCLAcceleratorMatrix<ValueType> {
17 
18 public:
19 
21  OCLAcceleratorMatrixCOO(const Paralution_Backend_Descriptor local_backend);
22  virtual ~OCLAcceleratorMatrixCOO();
23 
24  virtual void info(void) const;
25  virtual unsigned int get_mat_format(void) const{ return COO; }
26 
27  virtual void Clear(void);
28  virtual void AllocateCOO(const int nnz, const int nrow, const int ncol);
29 
30  virtual bool ConvertFrom(const BaseMatrix<ValueType> &mat);
31 
32  virtual bool Permute(const BaseVector<int> &permutation);
33  virtual bool PermuteBackward(const BaseVector<int> &permutation);
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_COO_HPP_
OCLAcceleratorMatrixCOO()
Definition: ocl_matrix_coo.cpp:17
MatrixCOO< cl_mem, cl_mem > mat_
Definition: ocl_matrix_coo.hpp:47
virtual void CopyFrom(const BaseMatrix< ValueType > &mat)
Copy from another matrix.
Definition: ocl_matrix_coo.cpp:234
virtual void Apply(const BaseVector< ValueType > &in, BaseVector< ValueType > *out) const
Apply the matrix to vector, out = this*in;.
Definition: ocl_matrix_coo.cpp:397
virtual void AllocateCOO(const int nnz, const int nrow, const int ncol)
Allocate COO Matrix.
Definition: ocl_matrix_coo.cpp:56
Definition: backend_manager.hpp:10
virtual void CopyToHost(HostMatrix< ValueType > *dst) const
Copy (accelerator matrix) to host matrix.
Definition: ocl_matrix_coo.cpp:181
virtual void Clear(void)
Clear (free) the matrix.
Definition: ocl_matrix_coo.cpp:113
nnz
Definition: pcg_example.m:8
virtual void info(void) const
Shows simple info about the object.
Definition: ocl_matrix_coo.cpp:49
virtual bool PermuteBackward(const BaseVector< int > &permutation)
Perform (backward) permutation of the matrix.
Definition: ocl_matrix_coo.cpp:812
const IndexType const IndexType const IndexType const ValueType const ValueType scalar
Definition: cuda_kernels_coo.hpp:91
virtual bool Permute(const BaseVector< int > &permutation)
Perform (forward) permutation of the matrix.
Definition: ocl_matrix_coo.cpp:785
virtual void CopyFromHost(const HostMatrix< ValueType > &src)
Copy (accelerator matrix) from host matrix.
Definition: ocl_matrix_coo.cpp:130
virtual bool ConvertFrom(const BaseMatrix< ValueType > &mat)
Convert the matrix from another matrix (with different structure)
Definition: ocl_matrix_coo.cpp:358
virtual unsigned int get_mat_format(void) const
Return the matrix format id (see matrix_formats.hpp)
Definition: ocl_matrix_coo.hpp:25
Base class for all host/accelerator matrices.
Definition: base_matrix.hpp:92
virtual ~OCLAcceleratorMatrixCOO()
Definition: ocl_matrix_coo.cpp:39
Definition: backend_manager.cpp:43
Definition: backend_manager.hpp:14
virtual void CopyTo(BaseMatrix< ValueType > *mat) const
Copy to another matrix.
Definition: ocl_matrix_coo.cpp:295
Definition: base_vector.hpp:19
Definition: matrix_formats.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;.
Definition: ocl_matrix_coo.cpp:592