ug4
ug::GPUVector< TValueType > Class Template Reference

#include <gpuvector.h>

+ Inheritance diagram for ug::GPUVector< TValueType >:

Public Types

typedef Vector< TValueType > super
 
typedef TValueType value_type
 
typedef GPUVector< TValueType > vector_type
 
- Public Types inherited from ug::Vector< TValueType >
typedef TValueType value_type
 
typedef Vector< TValueType > vector_type
 

Public Member Functions

void add (double alpha, const GPUVector< value_type > &v)
 
void assure_on_cpu ()
 
void assure_on_cpu () const
 
void assure_on_gpu ()
 
void assure_on_gpu () const
 
SmartPtr< vector_typeclone () const
 clones the vector (deep-copy) including values More...
 
SmartPtr< vector_typeclone_without_values () const
 clones the vector (deep-copy) excluding values More...
 
double dotprod (const GPUVector< value_type > &w) const
 
double * get_dev_ptr ()
 
const double * get_dev_ptr () const
 
 GPUVector ()
 constructor More...
 
 GPUVector (size_t _length)
 constructor with length More...
 
double norm () const
 return sqrt(sum values[i]^2) (euclidian norm) More...
 
bool on_cpu ()
 
bool on_gpu ()
 
void operator*= (const number &a)
 
void operator+= (const GPUVector< value_type > &v)
 
void operator-= (const GPUVector< value_type > &v)
 
void operator= (const GPUVector< value_type > &v)
 
value_typeoperator[] (size_t i)
 access element i of the vector More...
 
const value_typeoperator[] (size_t i) const
 
void reserve (size_t newCapacity, bool bCopyValues=true)
 
void reserve (size_t newCapacity, bool bCopyValues=true)
 
void resize (size_t newSize, bool bCopyValues=true)
 
void resize (size_t newSize, bool bCopyValues=true)
 
size_t size () const
 
- Public Member Functions inherited from ug::Vector< TValueType >
template<typename V >
void add (const V &u)
 
void add (const value_type *u, const size_t *indices, size_t nr)
 
size_t capacity () const
 
SmartPtr< vector_typeclone () const
 clones the vector (deep-copy) including values More...
 
SmartPtr< vector_typeclone_without_values () const
 clones the vector (deep-copy) excluding values More...
 
void create (const Vector &v)
 create as a copy of other vector More...
 
void create (size_t size)
 create a vector with specific size More...
 
size_t defragment ()
 
double dotprod (const Vector &w)
 returns v.T w, that is the dotprod of this vector and w More...
 
template<typename V >
void get (V &u) const
 
void get (value_type *u, const size_t *indices, size_t nr) const
 
double maxnorm () const
 return max values[i] (max norm) More...
 
double norm () const
 return sqrt(sum values[i]^2) (euclidian norm) More...
 
void operator*= (const number &a)
 
void operator+= (const Vector &v)
 
void operator-= (const Vector &v)
 
void operator= (const Vector &v)
 assign other vector v More...
 
double operator= (double d)
 assign double d to whole Vector More...
 
value_typeoperator[] (size_t i)
 access element i of the vector More...
 
const value_typeoperator[] (size_t i) const
 
void p ()
 gdb shortcut for print More...
 
void print (const char *const text=NULL) const
 print vector to console More...
 
void reserve (size_t newCapacity, bool bCopyValues=true)
 
void reserve_exactly (size_t newCapacity, bool bCopyValues)
 
void reserve_sloppy (size_t newCapacity, bool bCopyValues=true)
 
void resize (size_t newSize, bool bCopyValues=true)
 
void resize_exactly (size_t newSize, bool bCopyValues=true)
 resize the vector to be EXACTLY newSize big (no overhead) More...
 
void resize_sloppy (size_t newSize, bool bCopyValues=true)
 
template<typename V >
void set (const V &u)
 
void set (const value_type *u, const size_t *indices, size_t nr)
 
void set (double d)
 assign double d to whole Vector More...
 
void set_random (double from, double to)
 
size_t size () const
 
 Vector ()
 constructor More...
 
 Vector (const vector_type &v)
 
 Vector (size_t size)
 constructor with size More...
 
virtual ~Vector ()
 virtual destructor More...
 

Protected Member Functions

virtual vector_typevirtual_clone () const
 virtual clone using covariant return type More...
 
virtual vector_typevirtual_clone_without_values () const
 virtual clone using covariant return type excluding values More...
 

Private Types

enum  GPU_STATE { ON_GPU = 1 , ON_CPU = 2 , ON_GPU_AND_CPU = 3 }
 

Private Attributes

double * m_devValues
 
int m_GPUState
 
size_t m_sizeOnGPU
 

Member Typedef Documentation

◆ super

template<typename TValueType >
typedef Vector<TValueType> ug::GPUVector< TValueType >::super

◆ value_type

template<typename TValueType >
typedef TValueType ug::GPUVector< TValueType >::value_type

◆ vector_type

template<typename TValueType >
typedef GPUVector<TValueType> ug::GPUVector< TValueType >::vector_type

Member Enumeration Documentation

◆ GPU_STATE

template<typename TValueType >
enum ug::GPUVector::GPU_STATE
private
Enumerator
ON_GPU 
ON_CPU 
ON_GPU_AND_CPU 

Constructor & Destructor Documentation

◆ GPUVector() [1/2]

template<typename TValueType >
ug::GPUVector< TValueType >::GPUVector ( )
inline

◆ GPUVector() [2/2]

template<typename TValueType >
ug::GPUVector< TValueType >::GPUVector ( size_t  _length)
inline

Member Function Documentation

◆ add()

template<typename TValueType >
void ug::GPUVector< TValueType >::add ( double  alpha,
const GPUVector< value_type > &  v 
)
inline

◆ assure_on_cpu() [1/2]

◆ assure_on_cpu() [2/2]

template<typename TValueType >
void ug::GPUVector< TValueType >::assure_on_cpu ( ) const
inline

◆ assure_on_gpu() [1/2]

◆ assure_on_gpu() [2/2]

template<typename TValueType >
void ug::GPUVector< TValueType >::assure_on_gpu ( ) const
inline

◆ dotprod()

template<typename TValueType >
double ug::GPUVector< TValueType >::dotprod ( const GPUVector< value_type > &  w) const
inline

◆ get_dev_ptr() [1/2]

◆ get_dev_ptr() [2/2]

template<typename TValueType >
const double* ug::GPUVector< TValueType >::get_dev_ptr ( ) const
inline

◆ norm()

template<typename TValueType >
double ug::GPUVector< TValueType >::norm ( ) const
inline

return sqrt(sum values[i]^2) (euclidian norm)

References ug::GPUVector< TValueType >::get_dev_ptr(), and ug::GPUVector< TValueType >::size().

◆ on_cpu()

template<typename TValueType >
bool ug::GPUVector< TValueType >::on_cpu ( )
inline

◆ on_gpu()

template<typename TValueType >
bool ug::GPUVector< TValueType >::on_gpu ( )
inline

◆ operator*=()

template<typename TValueType >
void ug::GPUVector< TValueType >::operator*= ( const number a)
inline

◆ operator+=()

template<typename TValueType >
void ug::GPUVector< TValueType >::operator+= ( const GPUVector< value_type > &  v)
inline

◆ operator-=()

template<typename TValueType >
void ug::GPUVector< TValueType >::operator-= ( const GPUVector< value_type > &  v)
inline

◆ operator=()

template<typename TValueType >
void ug::GPUVector< TValueType >::operator= ( const GPUVector< value_type > &  v)
inline

◆ operator[]() [1/2]

template<typename TValueType >
value_type& ug::GPUVector< TValueType >::operator[] ( size_t  i)
inline

◆ operator[]() [2/2]

template<typename TValueType >
const value_type& ug::GPUVector< TValueType >::operator[] ( size_t  i) const
inline

◆ reserve() [1/2]

template<typename TValueType >
void ug::Vector< TValueType >::reserve
inline

◆ reserve() [2/2]

template<typename TValueType >
void ug::GPUVector< TValueType >::reserve ( size_t  newCapacity,
bool  bCopyValues = true 
)
inline

◆ resize() [1/2]

template<typename TValueType >
void ug::Vector< TValueType >::resize
inline

◆ resize() [2/2]

template<typename TValueType >
void ug::GPUVector< TValueType >::resize ( size_t  newSize,
bool  bCopyValues = true 
)
inline

◆ size()

Member Data Documentation

◆ m_devValues

template<typename TValueType >
double* ug::GPUVector< TValueType >::m_devValues
private

◆ m_GPUState

◆ m_sizeOnGPU

template<typename TValueType >
size_t ug::GPUVector< TValueType >::m_sizeOnGPU
private

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