Bolt
1.3
C++ template library with support for OpenCL
|
This defines the AMP version of a device_vector. More...
#include <device_vector.h>
Classes | |
class | const_reference_base |
class | iterator_base |
Base class provided to encapsulate all the common functionality for constant and non-constant iterators. More... | |
class | reference_base |
A writeable element of the container The location of an element of the container may not actually reside in system memory, but rather in device memory, which may be in a partitioned memory space. Access to a reference of the container results in a mapping and unmapping operation of device memory. More... | |
class | reverse_iterator_base |
A reverse random access iterator in the classic sense. More... | |
Public Types | |
typedef T | value_type |
typedef ptrdiff_t | difference_type |
typedef difference_type | distance_type |
typedef int | size_type |
typedef concurrency::array_view< T > | arrayview_type |
typedef concurrency::array< T > | array_type |
typedef CONT< T > | container_type |
typedef naked_pointer | pointer |
typedef const_naked_pointer | const_pointer |
typedef reference_base < device_vector< value_type, CONT > > | reference |
Typedef to create the non-constant reference. | |
typedef const_reference_base < device_vector< value_type, CONT > > | const_reference |
A non-writeable copy of an element of the container. Constant references are optimized to return a value_type, since it is certain that the value will not be modified. | |
typedef iterator_base < device_vector< value_type, CONT > > | iterator |
Typedef to create the non-constant iterator. | |
typedef iterator_base< const device_vector< value_type, CONT > > | const_iterator |
Typedef to create the constant iterator. | |
typedef reverse_iterator_base < device_vector< value_type, CONT > > | reverse_iterator |
Typedef to create the non-constant reverse iterator. | |
typedef reverse_iterator_base < const device_vector < value_type, CONT > > | const_reverse_iterator |
Typedef to create the constant reverse iterator. | |
Public Member Functions | |
device_vector (control &ctl=control::getDefault()) | |
A default constructor that creates an empty device_vector. | |
device_vector (size_type newSize, const value_type &initValue=value_type(), bool init=true, control &ctl=control::getDefault()) | |
A constructor that creates a new device_vector with the specified number of elements, with a specified initial value. | |
template<typename InputIterator > | |
device_vector (const InputIterator begin, size_type newSize, bool discard=false, control &ctl=control::getDefault(), typename std::enable_if< !std::is_integral< InputIterator >::value &&std::is_same< arrayview_type, container_type >::value >::type *=0) | |
A constructor that creates a new device_vector using a range specified by the user. | |
template<typename InputIterator > | |
device_vector (const InputIterator begin, size_type newSize, bool discard=false, control &ctl=control::getDefault(), typename std::enable_if< !std::is_integral< InputIterator >::value &&std::is_same< array_type, container_type >::value >::type *=0) | |
A constructor that creates a new device_vector using a range specified by the user. | |
template<typename T > | |
device_vector (const device_vector< T, CONT > &cont, bool copy=true, control &ctl=control::getDefault()) | |
A constructor that creates a new device_vector from device_vector specified by user. | |
device_vector (arrayview_type &cont) | |
A constructor that creates a new device_vector using a pre-initialized array supplied by the user. | |
device_vector (array_type &cont) | |
A constructor that creates a new device_vector using a pre-initialized array_view supplied by the user. | |
template<typename InputIterator > | |
device_vector (const InputIterator begin, const InputIterator end, bool discard=false, control &ctl=control::getDefault(), typename std::enable_if< std::is_same< arrayview_type, container_type >::value &&!std::is_integral< InputIterator >::value >::type *=0) | |
A constructor that creates a new device_vector using a range specified by the user. | |
template<typename InputIterator > | |
device_vector (const InputIterator begin, const InputIterator end, bool discard=false, control &ctl=control::getDefault(), typename std::enable_if< std::is_same< array_type, container_type >::value &&!std::is_integral< InputIterator >::value >::type *=0) | |
A constructor that creates a new device_vector using a range specified by the user. | |
arrayview_type | getBuffer () const |
A get accessor function to return the encapsulated device buffer for const objects. This member function allows access to the Buffer object, which can be retrieved through a reference or an iterator. This is necessary to allow library functions to get the encapsulated C++ AMP array object as a pass by reference argument to the C++ AMP parallel_for_each constructs. | |
arrayview_type | getBuffer (const_iterator itr, unsigned int size) const |
A get accessor function to return the encapsulated device buffer for const objects based on the iterator getIndex() and size. This member function allows access to the Buffer object, which can be retrieved through a reference or an iterator. This is necessary to allow library functions to get the encapsulated C++ AMP array object as a pass by reference argument to the C++ AMP parallel_for_each constructs. | |
arrayview_type | getBuffer (const_reverse_iterator itr, unsigned int size) const |
void | resize (size_type reqSize, const value_type &val=value_type()) |
Change the number of elements in device_vector to reqSize. If the new requested size is less than the original size, the data is truncated and lost. If the new size is greater than the original size, the extra paddign will be initialized with the value specified by the user. | |
size_type | size (void) const |
Return the number of known elements. | |
void | reserve (size_type reqSize) |
Request a change in the capacity of the device_vector. If reserve completes successfully, this device_vector object guarantees that the it can store the requested amount of elements without another reallocation, until the device_vector size exceeds n. | |
size_type | capacity (void) const |
Return the maximum possible number of elements without reallocation. | |
void | shrink_to_fit () |
Shrink the capacity( ) of this device_vector to just fit its elements. This makes the size( ) of the vector equal to its capacity( ). | |
value_type & | operator[] (size_type n) restrict(cpu |
Retrieves the value stored at index n. | |
value_type & | operator[] (size_type ix) const restrict(cpu |
Retrieves a constant value stored at index n. | |
iterator | begin (void) |
Retrieves an iterator for this container that points at the beginning element. | |
const_iterator | begin (void) const |
Retrieves an iterator for this container that points at the beginning constant element. No operation through this iterator may modify the contents of the referenced container. | |
const_iterator | cbegin (void) const |
Retrieves an iterator for this container that points at the beginning constant element. No operation through this iterator may modify the contents of the referenced container. | |
reverse_iterator | rbegin (void) |
Retrieves a reverse_iterator for this container that points at the last element. | |
const_reverse_iterator | rbegin (void) const |
Retrieves a reverse_iterator for this container that points at the last constant element. No operation through this iterator may modify the contents of the referenced container. | |
const_reverse_iterator | crbegin (void) const |
Retrieves an iterator for this container that points at the last constant element. No operation through this iterator may modify the contents of the referenced container. | |
iterator | end (void) |
Retrieves an iterator for this container that points at the last element. | |
const_iterator | end (void) const |
Retrieves an iterator for this container that points at the last constant element. No operation through this iterator may modify the contents of the referenced container. | |
const_iterator | cend (void) const |
Retrieves an iterator for this container that points at the last constant element. No operation through this iterator may modify the contents of the referenced container. | |
reverse_iterator | rend (void) |
Retrieves a reverse_iterator for this container that points at the beginning element. | |
const_reverse_iterator | rend (void) const |
Retrieves a reverse_iterator for this container that points at the beginning constant element. No operation through this iterator may modify the contents of the referenced container. | |
const_reverse_iterator | crend (void) const |
Retrieves a reverse_iterator for this container that points at the beginning constant element. No operation through this iterator may modify the contents of the referenced container. | |
value_type & | front (void) |
Retrieves the value stored at index 0. | |
const value_type & | front (void) const |
Retrieves the value stored at index 0. | |
value_type & | back (void) |
Retrieves the value stored at index size( ) - 1. | |
const value_type & | back (void) const |
Retrieves the value stored at index size( ) - 1. | |
pointer | data (void) |
const_pointer | data (void) const |
void | clear (void) |
Removes all elements (makes the device_vector empty). | |
bool | empty (void) const |
Test whether the container is empty. | |
void | push_back (const value_type &value) |
Appends a copy of the value to the container. | |
void | pop_back (void) |
Removes the last element, but does not return it. | |
void | swap (device_vector &vec) |
Swaps the contents of two device_vectors in an efficient manner. | |
iterator | erase (const_iterator index) |
Removes an element. | |
iterator | erase (const_iterator first, const_iterator last) |
Removes a range of elements. | |
iterator | insert (const_iterator index, const value_type &value) |
Insert a new element into the container. | |
void | insert (const_iterator index, size_type n, const value_type &value) |
Inserts n copies of the new element into the container. | |
template<typename InputIterator > | |
void | insert (const_iterator index, InputIterator begin, InputIterator end) |
void | assign (size_type newSize, const value_type &value) |
Assigns newSize copies of element value. | |
template<typename InputIterator > | |
std::enable_if < std::_Is_iterator < InputIterator >::value, void > ::type | assign (InputIterator begin, InputIterator end) |
Assigns a range of values to device_vector, replacing all previous elements. | |
Public Attributes | |
value_type | amp |
Friends | |
class | reference |
This defines the AMP version of a device_vector.
A device_vector is an abstract data type that provides random access to a flat, sequential region of memory that is performant for the device. This can imply different memories for different devices. For discrete class graphics, devices, this is most likely video memory; for APU devices, this can imply zero-copy memory; for CPU devices, this can imply standard host memory.
typedef const_reference_base< device_vector< value_type, CONT > > bolt::amp::device_vector< T, CONT >::const_reference |
A non-writeable copy of an element of the container. Constant references are optimized to return a value_type, since it is certain that the value will not be modified.
|
inline |
A default constructor that creates an empty device_vector.
ctl | An Bolt control class used to perform copy operations; a default is used if not supplied by the user |
|
inline |
A constructor that creates a new device_vector with the specified number of elements, with a specified initial value.
newSize | The number of elements of the new device_vector |
value | The value with which to initialize new elements. |
init | Boolean value to indicate whether to initialize device memory from initValue. |
ctl | A Bolt control class for copy operations; a default is used if not supplied by the user. |
|
inline |
A constructor that creates a new device_vector using a range specified by the user.
begin | An iterator pointing at the beginning of the range. |
newSize | The number of elements of the new device_vector |
discard | Boolean value to whether the container data will be discarded for read operation. |
ctl | A Bolt control class used to perform copy operations; a default is used if not supplied by the user. |
|
inline |
A constructor that creates a new device_vector using a range specified by the user.
begin | An iterator pointing at the beginning of the range. |
newSize | The number of elements of the new device_vector |
discard | Boolean value to whether the container data will be discarded for read operation. |
ctl | A Bolt control class used to perform copy operations; a default is used if not supplied by the user. |
|
inline |
A constructor that creates a new device_vector from device_vector specified by user.
cont | An device_vector object that has both .data() and .size() members |
copy | Boolean value to decide whether new device_vector will be shallow copy or deep copy |
ctl | A Bolt control class used to perform copy operations; a default is used if not supplied by the user. |
|
inline |
A constructor that creates a new device_vector using a pre-initialized array supplied by the user.
cont | An concurrency::array object. |
|
inline |
A constructor that creates a new device_vector using a pre-initialized array_view supplied by the user.
cont | An concurrency::array_view object. |
|
inline |
A constructor that creates a new device_vector using a range specified by the user.
begin | An iterator pointing at the beginning of the range. |
end | An iterator pointing at the end of the range. |
discard | Boolean value to whether the container data will be discarded for read operation. |
ctl | A Bolt control class used to perform copy operations; a default is used if not supplied by the user. |
|
inline |
A constructor that creates a new device_vector using a range specified by the user.
begin | An iterator pointing at the beginning of the range. |
end | An iterator pointing at the end of the range. |
discard | Boolean value to whether the container data will be discarded for read operation. |
ctl | A Bolt control class used to perform copy operations; a default is used if not supplied by the user. |
|
inline |
Assigns newSize copies of element value.
newSize | The new size of the device_vector. |
value | The value of the element that is replicated newSize times. |
|
inline |
Assigns a range of values to device_vector, replacing all previous elements.
begin | The iterator position signifiying the beginning of the range. |
end | The iterator position signifying the end of the range (exclusive). |
|
inline |
Retrieves the value stored at index size( ) - 1.
|
inline |
Retrieves the value stored at index size( ) - 1.
|
inline |
Retrieves an iterator for this container that points at the beginning element.
|
inline |
Retrieves an iterator for this container that points at the beginning constant element. No operation through this iterator may modify the contents of the referenced container.
|
inline |
Return the maximum possible number of elements without reallocation.
|
inline |
Retrieves an iterator for this container that points at the beginning constant element. No operation through this iterator may modify the contents of the referenced container.
|
inline |
Retrieves an iterator for this container that points at the last constant element. No operation through this iterator may modify the contents of the referenced container.
|
inline |
Removes all elements (makes the device_vector empty).
|
inline |
Retrieves an iterator for this container that points at the last constant element. No operation through this iterator may modify the contents of the referenced container.
|
inline |
Retrieves a reverse_iterator for this container that points at the beginning constant element. No operation through this iterator may modify the contents of the referenced container.
|
inline |
need to understand what Array_view.data is returning. Who should free the pointer?
|
inline |
Test whether the container is empty.
|
inline |
Retrieves an iterator for this container that points at the last element.
|
inline |
Retrieves an iterator for this container that points at the last constant element. No operation through this iterator may modify the contents of the referenced container.
|
inline |
Removes an element.
index | The iterator position in which to remove the element. |
|
inline |
Removes a range of elements.
begin | The iterator position signifiying the beginning of the range. |
end | The iterator position signifying the end of the range (exclusive). |
|
inline |
Retrieves the value stored at index 0.
|
inline |
Retrieves the value stored at index 0.
|
inline |
A get accessor function to return the encapsulated device buffer for const objects. This member function allows access to the Buffer object, which can be retrieved through a reference or an iterator. This is necessary to allow library functions to get the encapsulated C++ AMP array object as a pass by reference argument to the C++ AMP parallel_for_each constructs.
|
inline |
A get accessor function to return the encapsulated device buffer for const objects based on the iterator getIndex() and size. This member function allows access to the Buffer object, which can be retrieved through a reference or an iterator. This is necessary to allow library functions to get the encapsulated C++ AMP array object as a pass by reference argument to the C++ AMP parallel_for_each constructs.
itr | An iterator pointing at the beginning of the range. |
size | Size of buffer. |
|
inline |
Insert a new element into the container.
index | The iterator position to insert a copy of the element. |
value | The element to insert. |
|
inline |
Inserts n copies of the new element into the container.
index | The iterator position to insert n copies of the element. |
n | The number of copies of element. |
value | The element to insert. |
value_type& bolt::amp::device_vector< T, CONT >::operator[] | ( | size_type | n | ) |
Retrieves the value stored at index n.
value_type& bolt::amp::device_vector< T, CONT >::operator[] | ( | size_type | ix | ) | const |
Retrieves a constant value stored at index n.
|
inline |
Appends a copy of the value to the container.
value | The element to append |
|
inline |
Retrieves a reverse_iterator for this container that points at the last element.
|
inline |
Retrieves a reverse_iterator for this container that points at the last constant element. No operation through this iterator may modify the contents of the referenced container.
|
inline |
Retrieves a reverse_iterator for this container that points at the beginning element.
|
inline |
Retrieves a reverse_iterator for this container that points at the beginning constant element. No operation through this iterator may modify the contents of the referenced container.
|
inline |
Request a change in the capacity of the device_vector. If reserve completes successfully, this device_vector object guarantees that the it can store the requested amount of elements without another reallocation, until the device_vector size exceeds n.
n | The requested size of the device_vector in elements |
|
inline |
Change the number of elements in device_vector to reqSize. If the new requested size is less than the original size, the data is truncated and lost. If the new size is greater than the original size, the extra paddign will be initialized with the value specified by the user.
reqSize | The requested size of the device_vector in elements. |
val | All new elements are initialized with this new value. |
|
inline |
Shrink the capacity( ) of this device_vector to just fit its elements. This makes the size( ) of the vector equal to its capacity( ).
|
inline |
Return the number of known elements.
|
inline |
Swaps the contents of two device_vectors in an efficient manner.
vec | The device_vector to swap with. |
value_type bolt::amp::device_vector< T, CONT >::amp |