VexCL
Classes | Public Types | Public Member Functions | List of all members
vex::vector< T > Class Template Reference

Device vector. More...

#include <vector.hpp>

Inherits vector_terminal_expression.

Classes

class  element
 Proxy class. More...
 
class  iterator_type
 Iterator class. More...
 

Public Types

typedef T value_type
 
typedef size_t size_type
 
typedef iterator_type< vector,
element
iterator
 
typedef iterator_type< const
vector, const element
const_iterator
 
typedef std::unique_ptr< T[],
buffer_unmapper > 
mapped_array
 Host array mapped to device buffer. More...
 

Public Member Functions

 vector ()
 Empty constructor.
 
 vector (size_t size)
 Construct by size and use static context.
 
 vector (const vector &v)
 Copy constructor.
 
 vector (const cl::CommandQueue &q, const cl::Buffer &buffer)
 Wrap a native buffer.
 
 vector (const std::vector< cl::CommandQueue > &queue, size_t size, const T *host=0, cl_mem_flags flags=CL_MEM_READ_WRITE)
 Copy host data to the new buffer.
 
 vector (size_t size, const T *host, cl_mem_flags flags=CL_MEM_READ_WRITE)
 Copy host data to the new buffer, use static context.
 
 vector (const std::vector< cl::CommandQueue > &queue, const std::vector< T > &host, cl_mem_flags flags=CL_MEM_READ_WRITE)
 Copy host data to the new buffer.
 
 vector (const std::vector< T > &host, cl_mem_flags flags=CL_MEM_READ_WRITE)
 Copy host data to the new buffer, use static context.
 
 vector (vector &&v)
 Move constructor.
 
const vectoroperator= (vector &&v)
 Move assignment.
 
void swap (vector &v)
 Swap function.
 
void resize (const vector &v, cl_mem_flags flags=CL_MEM_READ_WRITE)
 Resize vector.
 
void resize (const std::vector< cl::CommandQueue > &queue, size_t size, const T *host=0, cl_mem_flags flags=CL_MEM_READ_WRITE)
 Resize vector.
 
void resize (const std::vector< cl::CommandQueue > &queue, const std::vector< T > &host, cl_mem_flags flags=CL_MEM_READ_WRITE)
 Resize vector.
 
void resize (size_t size)
 Resize vector with static context.
 
void clear ()
 Fills vector with zeros.
 
cl::Buffer operator() (uint d=0) const
 Return cl::Buffer object located on a given device.
 
const_iterator begin () const
 Const iterator to beginning.
 
const_iterator end () const
 Const iterator to end.
 
iterator begin ()
 Iterator to beginning.
 
iterator end ()
 Iterator to end.
 
const element operator[] (size_t index) const
 Access element.
 
element operator[] (size_t index)
 Access element.
 
size_t size () const
 Return size .
 
uint nparts () const
 Return number of parts (devices).
 
size_t part_size (uint d) const
 Return size of part on a given device.
 
size_t part_start (uint d) const
 Return part start for a given device.
 
const std::vector
< cl::CommandQueue > & 
queue_list () const
 Return reference to vector's queue list.
 
const std::vector< size_t > & partition () const
 Return reference to vector's partition.
 
const vectoroperator= (const vector &x)
 Copies data from device vector.
 
mapped_array map (uint d=0, cl_map_flags flags=CL_MAP_READ|CL_MAP_WRITE)
 Maps device buffer to host array.
 
void write_data (size_t offset, size_t size, const T *hostptr, cl_bool blocking, std::vector< cl::Event > *uevent=0)
 Copy data from host buffer to device(s).
 
void read_data (size_t offset, size_t size, T *hostptr, cl_bool blocking, std::vector< cl::Event > *uevent=0) const
 Copy data from device(s) to host buffer .
 
Expression assignments.

The appropriate kernel is compiled first time the assignment is made. Vectors participating in expression should have same number of parts; corresponding parts of the vectors should reside on the same compute devices.

template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator+= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator-= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator*= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator/= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator%= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator&= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator|= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator^= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator<<= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value,
const vector & >::type 
operator>>= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
additive_vector_transform_grammar >
::value, const vector & >
::type 
operator= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
additive_vector_transform_grammar >
::value, const vector & >
::type 
operator+= (const Expr &expr)
 
template<class Expr >
std::enable_if
< boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
additive_vector_transform_grammar >
::value, const vector & >
::type 
operator-= (const Expr &expr)
 
template<class Expr >
std::enable_if
< !boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value
&&!boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
additive_vector_transform_grammar >
::value, const vector & >
::type 
operator= (const Expr &expr)
 
template<class Expr >
std::enable_if
< !boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value
&&!boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
additive_vector_transform_grammar >
::value, const vector & >
::type 
operator+= (const Expr &expr)
 
template<class Expr >
std::enable_if
< !boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
vector_expr_grammar >::value
&&!boost::proto::matches
< typename
boost::proto::result_of::as_expr
< Expr >::type,
additive_vector_transform_grammar >
::value, const vector & >
::type 
operator-= (const Expr &expr)
 

Detailed Description

template<typename T>
class vex::vector< T >

Device vector.

Member Typedef Documentation

template<typename T>
typedef std::unique_ptr<T[], buffer_unmapper> vex::vector< T >::mapped_array

Host array mapped to device buffer.

Unmaps automatically when goes out of scope.


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