SkePU(integratedwithStarPU) 0.8
Classes | Public Member Functions | Friends
skepu::Vector< T > Class Template Reference

A vector container class, implemented as a wrapper for std::vector. It is configured to use StarPU DSM as its backend, which means that it does not do lazy memory copying in this translation. More...

#include <vector.h>

List of all members.

Classes

class  iterator
 An vector iterator class. More...
class  proxy_elem
 A proxy class representing one element of Vector. More...

Public Member Functions

void randomize (int min=0, int max=RAND_MAX)
 Randomizes the vector.
void save (const std::string &filename)
 Saves content of vector to a file.
void load (const std::string &filename, int numElements=0)
 Loads the vector from a file.
void unregisterVector (bool update=true)
starpu_data_handle_t registerPartitions (int _parts)
 To register and partition Vector with StarPU runtime.
 Vector ()
 Vector (const Vector &vec)
 Vector (size_type num, const T &val=T())
template<typename input_iterator >
 Vector (input_iterator start, input_iterator end)
 ~Vector ()
proxy_elem operator[] (const size_type index)
const T & operator[] (const size_type index) const
Vector< T > & operator= (const Vector< T > &other)
bool operator== (const Vector< T > &c1)
bool operator!= (const Vector< T > &c1)
bool operator< (const Vector< T > &c1)
bool operator> (const Vector< T > &c1)
bool operator<= (const Vector< T > &c1)
bool operator>= (const Vector< T > &c1)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
size_type capacity () const
size_type size () const
size_type max_size () const
void resize (size_type num, T val=T())
bool empty () const
void reserve (size_type size)
proxy_elem at (size_type loc)
const T & at (size_type loc) const
proxy_elem back ()
const T & back () const
proxy_elem front ()
const T & front () const
void assign (size_type num, const T &val)
template<typename input_iterator >
void assign (input_iterator start, input_iterator end)
void clear ()
void pop_back ()
void push_back (const T &val)
void swap (Vector< T > &from)
void flush ()
T & operator() (const size_type index)
void acquireRead () const
 Ensure that data is most updated for reading purpose on CPU.
void acquireReadWrite ()
 Ensure that data is available for reading and writing purpose on CPU First updates the vector from its device allocations. Then invalidates the data allocated on devices.
template<typename T>
Vector< T >::iterator insert (typename Vector< T >::iterator loc, const T &val)
template<typename T>
void insert (typename Vector< T >::iterator loc, size_type num, const T &val)
template<typename input_iterator >
void insert (typename Vector< T >::iterator loc, input_iterator start, input_iterator end)

Friends

std::ostream & operator<< (std::ostream &output, Vector< T > &vec)
 Overloaded stream operator, for testing purposes.

Detailed Description

template<typename T>
class skepu::Vector< T >

A vector container class, implemented as a wrapper for std::vector. It is configured to use StarPU DSM as its backend, which means that it does not do lazy memory copying in this translation.

A skepu::Vector is a container of vector/array type and is implemented as a wrapper for std::vector. Its interface and behaviour is largely compatible with std::vector but with some additions and variations.

Please refer to C++ STL vector documentation for more information about CPU side implementation.


Constructor & Destructor Documentation

template<typename T >
skepu::Vector< T >::Vector ( )

Please refer to the documentation of std::vector.

template<typename T >
skepu::Vector< T >::Vector ( const Vector< T > &  c)

Please refer to the documentation of std::vector.

Updates vector c before copying.

References skepu::Vector< T >::acquireRead().

Here is the call graph for this function:

template<typename T>
skepu::Vector< T >::Vector ( size_type  num,
const T &  val = T() 
) [explicit]

Please refer to the documentation of std::vector.

template<typename T >
template<typename input_iterator >
skepu::Vector< T >::Vector ( input_iterator  start,
input_iterator  end 
)

Please refer to the documentation of std::vector.

template<typename T >
skepu::Vector< T >::~Vector ( )

Releases all allocations made on device.


Member Function Documentation

template<typename T >
template<typename input_iterator >
void skepu::Vector< T >::assign ( input_iterator  start,
input_iterator  end 
)

Please refer to the documentation of std::vector.

template<typename T>
void skepu::Vector< T >::assign ( size_type  num,
const T &  val 
)

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::proxy_elem skepu::Vector< T >::at ( size_type  loc)

Please refer to the documentation of std::vector.

Returns a proxy_elem instead of an ordinary element. The proxy_elem usually behaves like an ordinary, but there might be exceptions.

template<typename T >
const T & skepu::Vector< T >::at ( size_type  loc) const

Please refer to the documentation of std::vector.

template<typename T >
const T & skepu::Vector< T >::back ( ) const

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::proxy_elem skepu::Vector< T >::back ( )

Please refer to the documentation of std::vector.

Returns a proxy_elem instead of an ordinary element. The proxy_elem usually behaves like an ordinary, but there might be exceptions.

template<typename T >
Vector< T >::const_iterator skepu::Vector< T >::begin ( ) const

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::iterator skepu::Vector< T >::begin ( )

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::size_type skepu::Vector< T >::capacity ( ) const

Please refer to the documentation of std::vector.

template<typename T >
void skepu::Vector< T >::clear ( )

Please refer to the documentation of std::vector.

template<typename T >
bool skepu::Vector< T >::empty ( ) const

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::iterator skepu::Vector< T >::end ( )

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::const_iterator skepu::Vector< T >::end ( ) const

Please refer to the documentation of std::vector.

template<typename T >
void skepu::Vector< T >::flush ( )

Flushes the vector, synchronizing it with the device then release all device allocations.

template<typename T >
Vector< T >::proxy_elem skepu::Vector< T >::front ( )

Please refer to the documentation of std::vector.

Returns a proxy_elem instead of an ordinary element. The proxy_elem usually behaves like an ordinary, but there might be exceptions.

template<typename T >
const T & skepu::Vector< T >::front ( ) const

Please refer to the documentation of std::vector.

template<typename T>
template<typename T>
Vector<T>::iterator skepu::Vector< T >::insert ( typename Vector< T >::iterator  loc,
const T &  val 
)

Please refer to the documentation of std::vector.

template<typename T>
template<typename T>
void skepu::Vector< T >::insert ( typename Vector< T >::iterator  loc,
size_type  num,
const T &  val 
)

Please refer to the documentation of std::vector.

template<typename T>
template<typename input_iterator >
void skepu::Vector< T >::insert ( typename Vector< T >::iterator  loc,
input_iterator  start,
input_iterator  end 
)

Please refer to the documentation of std::vector.

template<typename T>
void skepu::Vector< T >::load ( const std::string &  filename,
int  numElements = 0 
) [inline]

Loads the vector from a file.

Reads a variable nuimber of elements from a file. In the file, all elemets should be in ASCII on one line with whitespace between each element. Mainly for testing purposes.

Parameters:
filenameName of file to save to.
numElementsThe number of elements to load. Default value 0 means all values.

References skepu::Vector< T >::clear(), and skepu::Vector< T >::push_back().

Here is the call graph for this function:

template<typename T >
Vector< T >::size_type skepu::Vector< T >::max_size ( ) const

Please refer to the documentation of std::vector.

template<typename T>
bool skepu::Vector< T >::operator!= ( const Vector< T > &  c1)

Please refer to the documentation of std::vector.

References skepu::Vector< T >::acquireRead().

Here is the call graph for this function:

template<typename T >
T & skepu::Vector< T >::operator() ( const size_type  index)

Behaves like operator[] but does not care about synchronizing with device. Can be used when accessing many elements quickly so that no synchronization overhead effects performance. Make sure to properly synch with device by calling acquireRead etc before use.

Parameters:
indexIndex to a specific element of the vector.
template<typename T>
bool skepu::Vector< T >::operator< ( const Vector< T > &  c1)

Please refer to the documentation of std::vector.

References skepu::Vector< T >::acquireRead().

Here is the call graph for this function:

template<typename T>
bool skepu::Vector< T >::operator<= ( const Vector< T > &  c1)

Please refer to the documentation of std::vector.

References skepu::Vector< T >::acquireRead().

Here is the call graph for this function:

template<typename T>
Vector< T > & skepu::Vector< T >::operator= ( const Vector< T > &  other)

Please refer to the documentation of std::vector.

References skepu::Vector< T >::acquireRead().

Here is the call graph for this function:

template<typename T>
bool skepu::Vector< T >::operator== ( const Vector< T > &  c1)

Please refer to the documentation of std::vector.

References skepu::Vector< T >::acquireRead().

Here is the call graph for this function:

template<typename T>
bool skepu::Vector< T >::operator> ( const Vector< T > &  c1)

Please refer to the documentation of std::vector.

References skepu::Vector< T >::acquireRead().

Here is the call graph for this function:

template<typename T>
bool skepu::Vector< T >::operator>= ( const Vector< T > &  c1)

Please refer to the documentation of std::vector.

References skepu::Vector< T >::acquireRead().

Here is the call graph for this function:

template<typename T >
const T & skepu::Vector< T >::operator[] ( const size_type  index) const

Does not care about synchronizing with device. Can be used when accessing many elements quickly so that no synchronization overhead effects performance. Make sure to properly synch with device by calling updateHost etc before use.

Parameters:
indexIndex of element assuming continuous Matrix row-wise storage. To facilitate access using single indexing

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::proxy_elem skepu::Vector< T >::operator[] ( const size_type  index)

Please refer to the documentation of std::vector.

Returns a proxy_elem instead of an ordinary element. The proxy_elem usually behaves like an ordinary, but there might be exceptions.

template<typename T >
void skepu::Vector< T >::pop_back ( )

Please refer to the documentation of std::vector.

template<typename T>
void skepu::Vector< T >::push_back ( const T &  val)

Please refer to the documentation of std::vector.

template<typename T>
void skepu::Vector< T >::randomize ( int  min = 0,
int  max = RAND_MAX 
) [inline]

Randomizes the vector.

Sets each element of the vector to a random number between min and max. The numbers are generated as integers but are cast to the type of the vector.

Parameters:
minThe smallest number an element can become.
maxThe largest number an element can become.

References skepu::Vector< T >::unregisterVector().

Here is the call graph for this function:

template<typename T >
Vector< T >::const_reverse_iterator skepu::Vector< T >::rbegin ( ) const

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::reverse_iterator skepu::Vector< T >::rbegin ( )

Please refer to the documentation of std::vector.

template<typename T>
starpu_data_handle_t skepu::Vector< T >::registerPartitions ( int  _parts) [inline]

To register and partition Vector with StarPU runtime.

Parameters:
_partsnumber of partitions to create of this matrix (block-wise).
template<typename T >
Vector< T >::reverse_iterator skepu::Vector< T >::rend ( )

Please refer to the documentation of std::vector.

template<typename T >
Vector< T >::const_reverse_iterator skepu::Vector< T >::rend ( ) const

Please refer to the documentation of std::vector.

template<typename T >
void skepu::Vector< T >::reserve ( size_type  size)

Please refer to the documentation of std::vector.

template<typename T>
void skepu::Vector< T >::resize ( size_type  num,
val = T() 
)

resize matrix,,, invalidates all copies before resizing.

Please refer to the documentation of std::vector.

template<typename T>
void skepu::Vector< T >::save ( const std::string &  filename) [inline]

Saves content of vector to a file.

Outputs the vector as text on one line with space between elements to the specified file. Mainly for testing purposes.

Parameters:
filenameName of file to save to.

References skepu::Vector< T >::at(), and skepu::Vector< T >::size().

Here is the call graph for this function:

template<typename T >
Vector< T >::size_type skepu::Vector< T >::size ( ) const

Please refer to the documentation of std::vector.

template<typename T>
void skepu::Vector< T >::swap ( Vector< T > &  from)

Please refer to the documentation of std::vector.

References skepu::Vector< T >::unregisterVector().

Here is the call graph for this function:

template<typename T>
void skepu::Vector< T >::unregisterVector ( bool  update = true) [inline]

/brief Used to unregister data handle with StarPU (pass "false" to not ensure most updated value is returned back)


Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  output,
Vector< T > &  vec 
) [friend]

Overloaded stream operator, for testing purposes.

Outputs the vector on one line with space between elements to the chosen stream.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Enumerations Friends Defines