HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CE_VectorT< T > Class Template Reference

#include <CE_Vector.h>

Public Types

typedef T value_type
 

Public Member Functions

 CE_VectorT ()
 
 CE_VectorT (exint len, bool use_pool=false, bool read=true, bool write=true)
 Initialize to given length. More...
 
 CE_VectorT (bool use_pool, bool read, bool write)
 
 CE_VectorT (const CE_VectorT< T > &v)
 Copy constructor. More...
 
 ~CE_VectorT ()
 
void init (exint len, bool doalloc=true)
 
void init (exint nl, exint nh)
 
void initFromVector (const UT_VectorT< T > &src, bool block=true)
 Initialize from a UT_Vector. More...
 
void initFromBuffer (const cl::Buffer &src, exint size, int tuplesize=1)
 Initialize from a cl::Buffer, which this vector does not own. More...
 
void matchAndCopyToVector (UT_VectorT< T > &dst, bool block=true) const
 Resize the provided UT_Vector to fit and copy this vector's data there. More...
 
exint length () const
 Returns the vector length. More...
 
int tupleSize () const
 Returns the size of the tuple contained in the vector. More...
 
exint tupleCount () const
 Returns the number of tuples contained in the vector. More...
 
const cl::Bufferbuffer () const
 Returns the underlying OpenCL buffer. More...
 
void multAndSet (const CE_VectorT< T > &a, const CE_VectorT< T > &b)
 The following functions all mimic those of the same name in UT_Vector. More...
 
void negPlus (const CE_VectorT< T > &a)
 
void scaleAddVec (T s, const CE_VectorT< T > &a)
 
fpreal64 norm (int type) const
 
void zero ()
 
void addScaledVec (T s, const CE_VectorT< T > &a)
 
CE_VectorToperator= (const CE_VectorT< T > &v)
 
fpreal64 sum (int comp=0) const
 Reductions of the vector to a single value. More...
 
fpreal64 sumAbs (int comp=0) const
 
fpreal64 sumSqr (int comp=0) const
 
fpreal64 min (int comp=0) const
 
fpreal64 minAbs (int comp=0) const
 
fpreal64 max (int comp=0) const
 
fpreal64 maxAbs (int comp=0) const
 
fpreal64 average (int comp=0) const
 
fpreal64 rms (int comp=0) const
 
fpreal64 dot (const CE_VectorT< T > &a) const
 Returns the dot product with provided vector. More...
 
cl::KernelFunctor bind (cl::Kernel &k) const
 
void setValue (T cval)
 
void copyFrom (const CE_VectorT< T > &v)
 

Protected Member Functions

const cl::BufferallocBuffer () const
 
void releaseBuffer ()
 
cl::KernelFunctor bind (const char *kernelName) const
 
cl::Kernel loadKernel (const char *kernelName, const char *opt=NULL) const
 
void getReductionRanges (const cl::Kernel &k, cl::NDRange &globalRange, cl::NDRange &localRange, uint &groupsize, uint &ngroups, size_t &accumsize) const
 
fpreal64 reduceGroup (cl::Buffer out, uint groupsize, uint ngroups, size_t accumsize, const char *reduceFlags) const
 
fpreal64 doReduce (const char *reduceFlags, const CE_VectorT< T > *a=NULL, int tuplesize=1, int comp=0) const
 

Protected Attributes

cl::Buffer myBuffer
 
cl::NDRange myGlobalRange
 
cl::NDRange myLocalRange
 
exint myLen
 
int myTupleSize
 
bool myRead
 
bool myWrite
 
bool myUsePool
 

Detailed Description

template<typename T>
class CE_VectorT< T >

A simple OpenCL-based vector class that at the moment just mimics just enough of UT_Vector to be used in CE_SparseMatrixELLT::solveConjugateGradient.

Definition at line 25 of file CE_Vector.h.

Member Typedef Documentation

template<typename T>
typedef T CE_VectorT< T >::value_type

Definition at line 29 of file CE_Vector.h.

Constructor & Destructor Documentation

template<typename T>
CE_VectorT< T >::CE_VectorT ( )
template<typename T>
CE_VectorT< T >::CE_VectorT ( exint  len,
bool  use_pool = false,
bool  read = true,
bool  write = true 
)

Initialize to given length.

template<typename T>
CE_VectorT< T >::CE_VectorT ( bool  use_pool,
bool  read,
bool  write 
)

Initialize to zero in in the cases when we want to init / not init the vector based on size

template<typename T>
CE_VectorT< T >::CE_VectorT ( const CE_VectorT< T > &  v)

Copy constructor.

template<typename T>
CE_VectorT< T >::~CE_VectorT ( )

Member Function Documentation

template<typename T>
void CE_VectorT< T >::addScaledVec ( T  s,
const CE_VectorT< T > &  a 
)
template<typename T>
const cl::Buffer& CE_VectorT< T >::allocBuffer ( ) const
protected
template<typename T>
fpreal64 CE_VectorT< T >::average ( int  comp = 0) const
inline

Definition at line 98 of file CE_Vector.h.

template<typename T>
cl::KernelFunctor CE_VectorT< T >::bind ( cl::Kernel k) const
template<typename T>
cl::KernelFunctor CE_VectorT< T >::bind ( const char *  kernelName) const
protected
template<typename T>
const cl::Buffer& CE_VectorT< T >::buffer ( ) const
inline

Returns the underlying OpenCL buffer.

Definition at line 71 of file CE_Vector.h.

template<typename T>
void CE_VectorT< T >::copyFrom ( const CE_VectorT< T > &  v)
template<typename T>
fpreal64 CE_VectorT< T >::doReduce ( const char *  reduceFlags,
const CE_VectorT< T > *  a = NULL,
int  tuplesize = 1,
int  comp = 0 
) const
protected
template<typename T>
fpreal64 CE_VectorT< T >::dot ( const CE_VectorT< T > &  a) const

Returns the dot product with provided vector.

template<typename T>
void CE_VectorT< T >::getReductionRanges ( const cl::Kernel k,
cl::NDRange globalRange,
cl::NDRange localRange,
uint groupsize,
uint ngroups,
size_t &  accumsize 
) const
protected
template<typename T>
void CE_VectorT< T >::init ( exint  len,
bool  doalloc = true 
)

Initialize to given length. NOTE- values are undefined.

template<typename T>
void CE_VectorT< T >::init ( exint  nl,
exint  nh 
)

For "compatibility" with UT_Vector. NOTE: Asserts if nl is not zero!

template<typename T>
void CE_VectorT< T >::initFromBuffer ( const cl::Buffer src,
exint  size,
int  tuplesize = 1 
)

Initialize from a cl::Buffer, which this vector does not own.

template<typename T>
void CE_VectorT< T >::initFromVector ( const UT_VectorT< T > &  src,
bool  block = true 
)

Initialize from a UT_Vector.

template<typename T>
exint CE_VectorT< T >::length ( ) const
inline

Returns the vector length.

Definition at line 64 of file CE_Vector.h.

template<typename T>
cl::Kernel CE_VectorT< T >::loadKernel ( const char *  kernelName,
const char *  opt = NULL 
) const
protected
template<typename T>
void CE_VectorT< T >::matchAndCopyToVector ( UT_VectorT< T > &  dst,
bool  block = true 
) const

Resize the provided UT_Vector to fit and copy this vector's data there.

template<typename T>
fpreal64 CE_VectorT< T >::max ( int  comp = 0) const
template<typename T>
fpreal64 CE_VectorT< T >::maxAbs ( int  comp = 0) const
template<typename T>
fpreal64 CE_VectorT< T >::min ( int  comp = 0) const
template<typename T>
fpreal64 CE_VectorT< T >::minAbs ( int  comp = 0) const
template<typename T>
void CE_VectorT< T >::multAndSet ( const CE_VectorT< T > &  a,
const CE_VectorT< T > &  b 
)

The following functions all mimic those of the same name in UT_Vector.

template<typename T>
void CE_VectorT< T >::negPlus ( const CE_VectorT< T > &  a)
template<typename T>
fpreal64 CE_VectorT< T >::norm ( int  type) const
template<typename T>
CE_VectorT& CE_VectorT< T >::operator= ( const CE_VectorT< T > &  v)

Operators NOTE: operator= requires the destination be a matching size.

template<typename T>
fpreal64 CE_VectorT< T >::reduceGroup ( cl::Buffer  out,
uint  groupsize,
uint  ngroups,
size_t  accumsize,
const char *  reduceFlags 
) const
protected
template<typename T>
void CE_VectorT< T >::releaseBuffer ( )
protected
template<typename T>
fpreal64 CE_VectorT< T >::rms ( int  comp = 0) const
inline

Definition at line 99 of file CE_Vector.h.

template<typename T>
void CE_VectorT< T >::scaleAddVec ( T  s,
const CE_VectorT< T > &  a 
)
template<typename T>
void CE_VectorT< T >::setValue ( T  cval)
template<typename T>
fpreal64 CE_VectorT< T >::sum ( int  comp = 0) const

Reductions of the vector to a single value.

template<typename T>
fpreal64 CE_VectorT< T >::sumAbs ( int  comp = 0) const
template<typename T>
fpreal64 CE_VectorT< T >::sumSqr ( int  comp = 0) const
template<typename T>
exint CE_VectorT< T >::tupleCount ( ) const
inline

Returns the number of tuples contained in the vector.

Definition at line 68 of file CE_Vector.h.

template<typename T>
int CE_VectorT< T >::tupleSize ( ) const
inline

Returns the size of the tuple contained in the vector.

Definition at line 66 of file CE_Vector.h.

template<typename T>
void CE_VectorT< T >::zero ( )
inline

Definition at line 82 of file CE_Vector.h.

Member Data Documentation

template<typename T>
cl::Buffer CE_VectorT< T >::myBuffer
mutableprotected

Definition at line 130 of file CE_Vector.h.

template<typename T>
cl::NDRange CE_VectorT< T >::myGlobalRange
protected

Definition at line 131 of file CE_Vector.h.

template<typename T>
exint CE_VectorT< T >::myLen
protected

Definition at line 132 of file CE_Vector.h.

template<typename T>
cl::NDRange CE_VectorT< T >::myLocalRange
protected

Definition at line 131 of file CE_Vector.h.

template<typename T>
bool CE_VectorT< T >::myRead
protected

Definition at line 135 of file CE_Vector.h.

template<typename T>
int CE_VectorT< T >::myTupleSize
protected

Definition at line 133 of file CE_Vector.h.

template<typename T>
bool CE_VectorT< T >::myUsePool
protected

Definition at line 135 of file CE_Vector.h.

template<typename T>
bool CE_VectorT< T >::myWrite
protected

Definition at line 135 of file CE_Vector.h.


The documentation for this class was generated from the following file: