remora::gpu::vector< T > Class Template Reference

A dense vector of values of type T sored on the GPU. More...

#include <shark/LinAlg/BLAS/gpu/vector.hpp>

+ Inheritance diagram for remora::gpu::vector< T >:

Public Types

typedef value_type const_reference
 
typedef value_type reference
 
typedef elementwise< dense_tag > evaluation_category
 
typedef boost::compute::vector< T >::iterator iterator
 
typedef boost::compute::vector< T >::const_iterator const_iterator
 

Public Member Functions

 vector (boost::compute::command_queue &queue=boost::compute::system::default_queue())
 Constructor of a vector with a default queue. More...
 
 vector (size_type size, boost::compute::command_queue &queue=boost::compute::system::default_queue())
 Constructor of a vector with a predefined size By default, its elements are uninitialized. More...
 
 vector (size_type size, value_type const &init, boost::compute::command_queue &queue=boost::compute::system::default_queue())
 Constructor of a vector with a predefined size and a unique initial value. More...
 
 vector (vector &&v)
 Move-constructor of a vector. More...
 
 vector (vector const &v)=default
 Copy-constructor of a vector. More...
 
template<class E >
 vector (vector_expression< E, gpu_tag > const &e)
 Copy-constructor of a vector from a vector_expression. More...
 
template<class E >
 vector (vector_expression< E, gpu_tag > const &e, boost::compute::command_queue &queue)
 Copy-constructor of a vector from a vector_expression on a given queue. More...
 
template<class IndexExpr >
detail::induced_vector_element< IndexExpr, T > operator() (IndexExpr const &i) const
 
vectoroperator= (vector const &v)
 Assign a full vector (RHS-vector) to the current vector (LHS-vector) Assign a full vector (RHS-vector) to the current vector (LHS-vector). This method does not create any temporary. More...
 
vectoroperator= (vector &&v)
 Move-Assign a full vector (RHS-vector) to the current vector (LHS-vector) More...
 
template<class C >
vectoroperator= (vector_container< C, gpu_tag > const &v)
 Assign a full vector (RHS-vector) to the current vector (LHS-vector) Assign a full vector (RHS-vector) to the current vector (LHS-vector). This method does not create any temporary. More...
 
template<class E >
vectoroperator= (vector_expression< E, gpu_tag > const &e)
 Assign the result of a vector_expression to the vector. More...
 
size_type size () const
 Return the size of the vector. More...
 
boost::compute::command_queue & queue () const
 
const_storage_type raw_storage () const
 Returns the underlying storage structure for low level access. More...
 
void resize (size_type size)
 Resize the vector. More...
 
void resize (size_type size, value_type init)
 Resize the vector. More...
 
void clear ()
 
bool empty () const
 
const_iterator cbegin () const
 return an iterator on the first element of the vector More...
 
const_iterator cend () const
 return an iterator after the last element of the vector More...
 
const_iterator begin () const
 return an iterator on the first element of the vector More...
 
const_iterator end () const
 return an iterator after the last element of the vector More...
 
iterator begin ()
 Return an iterator on the first element of the vector. More...
 
iterator end ()
 Return an iterator at the end of the vector. More...
 
- Public Member Functions inherited from remora::vector_container< vector< T >, gpu_tag >
const container_type & operator() () const
 
container_type & operator() ()
 
- Public Member Functions inherited from remora::vector_expression< vector< T >, gpu_tag >
const expression_type & operator() () const
 
expression_type & operator() ()
 

Friends

void swap (vector &v1, vector &v2)
 Swap the content of two vectors. More...
 

Detailed Description

template<class T>
class remora::gpu::vector< T >

A dense vector of values of type T sored on the GPU.

For a \(n\)-dimensional vector \(v\) and \(0\leq i < n\) every element \(v_i\) is mapped to the \(i\)-th element of the container.

Template Parameters
Ttype of the objects stored in the vector (like int, double, complex,...)

Definition at line 65 of file vector.hpp.

Member Typedef Documentation

◆ const_iterator

template<class T >
typedef boost::compute::vector<T>::const_iterator remora::gpu::vector< T >::const_iterator

Definition at line 239 of file vector.hpp.

◆ const_reference

template<class T >
typedef value_type remora::gpu::vector< T >::const_reference

Definition at line 69 of file vector.hpp.

◆ evaluation_category

template<class T >
typedef elementwise<dense_tag> remora::gpu::vector< T >::evaluation_category

Definition at line 77 of file vector.hpp.

◆ iterator

template<class T >
typedef boost::compute::vector<T>::iterator remora::gpu::vector< T >::iterator

Definition at line 238 of file vector.hpp.

◆ reference

template<class T >
typedef value_type remora::gpu::vector< T >::reference

Definition at line 70 of file vector.hpp.

Constructor & Destructor Documentation

◆ vector() [1/7]

template<class T >
remora::gpu::vector< T >::vector ( boost::compute::command_queue &  queue = boost::compute::system::default_queue())
inline

Constructor of a vector with a default queue.

note that for all operations for which vector is on the left hand side, the kernels are enqueued on the supplied queue in case of a multi-queue setup.

Definition at line 85 of file vector.hpp.

◆ vector() [2/7]

template<class T >
remora::gpu::vector< T >::vector ( size_type  size,
boost::compute::command_queue &  queue = boost::compute::system::default_queue() 
)
inlineexplicit

Constructor of a vector with a predefined size By default, its elements are uninitialized.

Parameters
sizeinitial size of the vector
queuethe opencl queue to use by this vector

Definition at line 92 of file vector.hpp.

◆ vector() [3/7]

template<class T >
remora::gpu::vector< T >::vector ( size_type  size,
value_type const &  init,
boost::compute::command_queue &  queue = boost::compute::system::default_queue() 
)
inline

Constructor of a vector with a predefined size and a unique initial value.

Parameters
sizeof the vector
initvalue to assign to each element of the vector
queuethe opencl queue to use by this vector

Definition at line 99 of file vector.hpp.

◆ vector() [4/7]

template<class T >
remora::gpu::vector< T >::vector ( vector< T > &&  v)
inline

Move-constructor of a vector.

Parameters
vis the vector to be moved

Definition at line 104 of file vector.hpp.

◆ vector() [5/7]

template<class T >
remora::gpu::vector< T >::vector ( vector< T > const &  v)
default

Copy-constructor of a vector.

Parameters
vis the vector to be duplicated

◆ vector() [6/7]

template<class T >
template<class E >
remora::gpu::vector< T >::vector ( vector_expression< E, gpu_tag > const &  e)
inline

Copy-constructor of a vector from a vector_expression.

Parameters
ethe vector_expression whose values will be duplicated into the vector

Definition at line 115 of file vector.hpp.

References remora::assign().

◆ vector() [7/7]

template<class T >
template<class E >
remora::gpu::vector< T >::vector ( vector_expression< E, gpu_tag > const &  e,
boost::compute::command_queue &  queue 
)
inline

Copy-constructor of a vector from a vector_expression on a given queue.

Parameters
ethe vector_expression whose values will be duplicated into the vector
queuethe queue which should perform the task

Definition at line 125 of file vector.hpp.

References remora::assign().

Member Function Documentation

◆ begin() [1/2]

template<class T >
const_iterator remora::gpu::vector< T >::begin ( ) const
inline

return an iterator on the first element of the vector

Definition at line 252 of file vector.hpp.

◆ begin() [2/2]

template<class T >
iterator remora::gpu::vector< T >::begin ( )
inline

Return an iterator on the first element of the vector.

Definition at line 262 of file vector.hpp.

◆ cbegin()

template<class T >
const_iterator remora::gpu::vector< T >::cbegin ( ) const
inline

return an iterator on the first element of the vector

Definition at line 242 of file vector.hpp.

◆ cend()

template<class T >
const_iterator remora::gpu::vector< T >::cend ( ) const
inline

return an iterator after the last element of the vector

Definition at line 247 of file vector.hpp.

◆ clear()

template<class T >
void remora::gpu::vector< T >::clear ( )
inline

Definition at line 220 of file vector.hpp.

◆ empty()

template<class T >
bool remora::gpu::vector< T >::empty ( ) const
inline

Definition at line 224 of file vector.hpp.

◆ end() [1/2]

template<class T >
const_iterator remora::gpu::vector< T >::end ( ) const
inline

return an iterator after the last element of the vector

Definition at line 257 of file vector.hpp.

◆ end() [2/2]

template<class T >
iterator remora::gpu::vector< T >::end ( )
inline

Return an iterator at the end of the vector.

Definition at line 267 of file vector.hpp.

◆ operator()()

template<class T >
template<class IndexExpr >
detail::induced_vector_element<IndexExpr,T> remora::gpu::vector< T >::operator() ( IndexExpr const &  i) const
inline

Definition at line 133 of file vector.hpp.

◆ operator=() [1/4]

template<class T >
vector& remora::gpu::vector< T >::operator= ( vector< T > const &  v)
inline

Assign a full vector (RHS-vector) to the current vector (LHS-vector) Assign a full vector (RHS-vector) to the current vector (LHS-vector). This method does not create any temporary.

Parameters
vis the source vector container
Returns
a reference to a vector (i.e. the destination vector)

Definition at line 145 of file vector.hpp.

References remora::assign(), and remora::gpu::vector< T >::size().

◆ operator=() [2/4]

template<class T >
vector& remora::gpu::vector< T >::operator= ( vector< T > &&  v)
inline

Move-Assign a full vector (RHS-vector) to the current vector (LHS-vector)

Parameters
vis the source vector container
Returns
a reference to a vector (i.e. the destination vector)

Definition at line 153 of file vector.hpp.

◆ operator=() [3/4]

template<class T >
template<class C >
vector& remora::gpu::vector< T >::operator= ( vector_container< C, gpu_tag > const &  v)
inline

Assign a full vector (RHS-vector) to the current vector (LHS-vector) Assign a full vector (RHS-vector) to the current vector (LHS-vector). This method does not create any temporary.

Parameters
vis the source vector container
Returns
a reference to a vector (i.e. the destination vector)

Definition at line 164 of file vector.hpp.

References remora::assign().

◆ operator=() [4/4]

template<class T >
template<class E >
vector& remora::gpu::vector< T >::operator= ( vector_expression< E, gpu_tag > const &  e)
inline

Assign the result of a vector_expression to the vector.

Parameters
eis a const reference to the vector_expression
Returns
a reference to the resulting vector

Definition at line 174 of file vector.hpp.

References shark::swap().

◆ queue()

template<class T >
boost::compute::command_queue& remora::gpu::vector< T >::queue ( ) const
inline

Definition at line 189 of file vector.hpp.

◆ raw_storage()

template<class T >
const_storage_type remora::gpu::vector< T >::raw_storage ( ) const
inline

Returns the underlying storage structure for low level access.

Definition at line 193 of file vector.hpp.

◆ resize() [1/2]

template<class T >
void remora::gpu::vector< T >::resize ( size_type  size)
inline

Resize the vector.

This might erase all data stored in the vector

Parameters
sizenew size of the vector

Definition at line 202 of file vector.hpp.

◆ resize() [2/2]

template<class T >
void remora::gpu::vector< T >::resize ( size_type  size,
value_type  init 
)
inline

Resize the vector.

This will erase all data stored in the vector and reinitialize it with the supplied value of init

Parameters
sizenew size of the vector
initthe value of all elements

Definition at line 215 of file vector.hpp.

References remora::init().

◆ size()

template<class T >
size_type remora::gpu::vector< T >::size ( ) const
inline

Return the size of the vector.

Definition at line 185 of file vector.hpp.

Referenced by remora::gpu::vector< T >::operator=().

Friends And Related Function Documentation

◆ swap

template<class T >
void swap ( vector< T > &  v1,
vector< T > &  v2 
)
friend

Swap the content of two vectors.

Parameters
v1is the first vector. It takes values from v2
v2is the second vector It takes values from v1

Definition at line 231 of file vector.hpp.


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