HDK
|
#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::Buffer & | buffer () 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_VectorT & | operator= (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::Buffer & | allocBuffer () 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 |
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.
typedef T CE_VectorT< T >::value_type |
Definition at line 29 of file CE_Vector.h.
CE_VectorT< T >::CE_VectorT | ( | ) |
CE_VectorT< T >::CE_VectorT | ( | exint | len, |
bool | use_pool = false , |
||
bool | read = true , |
||
bool | write = true |
||
) |
Initialize to given length.
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
CE_VectorT< T >::CE_VectorT | ( | const CE_VectorT< T > & | v | ) |
Copy constructor.
CE_VectorT< T >::~CE_VectorT | ( | ) |
void CE_VectorT< T >::addScaledVec | ( | T | s, |
const CE_VectorT< T > & | a | ||
) |
|
protected |
|
inline |
Definition at line 98 of file CE_Vector.h.
cl::KernelFunctor CE_VectorT< T >::bind | ( | cl::Kernel & | k | ) | const |
|
protected |
|
inline |
Returns the underlying OpenCL buffer.
Definition at line 71 of file CE_Vector.h.
void CE_VectorT< T >::copyFrom | ( | const CE_VectorT< T > & | v | ) |
|
protected |
fpreal64 CE_VectorT< T >::dot | ( | const CE_VectorT< T > & | a | ) | const |
Returns the dot product with provided vector.
|
protected |
void CE_VectorT< T >::init | ( | exint | len, |
bool | doalloc = true |
||
) |
Initialize to given length. NOTE- values are undefined.
void CE_VectorT< T >::init | ( | exint | nl, |
exint | nh | ||
) |
For "compatibility" with UT_Vector. NOTE: Asserts if nl is not zero!
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.
void CE_VectorT< T >::initFromVector | ( | const UT_VectorT< T > & | src, |
bool | block = true |
||
) |
Initialize from a UT_Vector.
|
inline |
Returns the vector length.
Definition at line 64 of file CE_Vector.h.
|
protected |
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.
fpreal64 CE_VectorT< T >::max | ( | int | comp = 0 | ) | const |
fpreal64 CE_VectorT< T >::maxAbs | ( | int | comp = 0 | ) | const |
fpreal64 CE_VectorT< T >::min | ( | int | comp = 0 | ) | const |
fpreal64 CE_VectorT< T >::minAbs | ( | int | comp = 0 | ) | const |
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.
void CE_VectorT< T >::negPlus | ( | const CE_VectorT< T > & | a | ) |
fpreal64 CE_VectorT< T >::norm | ( | int | type | ) | const |
CE_VectorT& CE_VectorT< T >::operator= | ( | const CE_VectorT< T > & | v | ) |
Operators NOTE: operator= requires the destination be a matching size.
|
protected |
|
protected |
|
inline |
Definition at line 99 of file CE_Vector.h.
void CE_VectorT< T >::scaleAddVec | ( | T | s, |
const CE_VectorT< T > & | a | ||
) |
void CE_VectorT< T >::setValue | ( | T | cval | ) |
fpreal64 CE_VectorT< T >::sum | ( | int | comp = 0 | ) | const |
Reductions of the vector to a single value.
fpreal64 CE_VectorT< T >::sumAbs | ( | int | comp = 0 | ) | const |
fpreal64 CE_VectorT< T >::sumSqr | ( | int | comp = 0 | ) | const |
|
inline |
Returns the number of tuples contained in the vector.
Definition at line 68 of file CE_Vector.h.
|
inline |
Returns the size of the tuple contained in the vector.
Definition at line 66 of file CE_Vector.h.
|
inline |
Definition at line 82 of file CE_Vector.h.
|
mutableprotected |
Definition at line 130 of file CE_Vector.h.
|
protected |
Definition at line 131 of file CE_Vector.h.
|
protected |
Definition at line 132 of file CE_Vector.h.
|
protected |
Definition at line 131 of file CE_Vector.h.
|
protected |
Definition at line 135 of file CE_Vector.h.
|
protected |
Definition at line 133 of file CE_Vector.h.
|
protected |
Definition at line 135 of file CE_Vector.h.
|
protected |
Definition at line 135 of file CE_Vector.h.