HCC
HCC is a single-source, C/C++ compiler for heterogeneous computing. It's optimized with HSA (http://www.hsafoundation.com/).
|
Represents an N-dimensional region of memory (with type T) located on an accelerator. More...
#include <hc.hpp>
Public Types | |
typedef Kalmar::_data_host< T > | acc_buffer_t |
typedef T | value_type |
The element type of this array. | |
Public Member Functions | |
array ()=delete | |
There is no default constructor for array<T,N>. | |
array (const array &other) | |
Copy constructor. More... | |
array (array &&other) | |
Move constructor. More... | |
array (const extent< N > &ext) | |
Constructs a new array with the supplied extent, located on the default view of the default accelerator. More... | |
array (const array_view< const T, N > &src) | |
Constructs a new array, located on the default view of the default accelerator, initialized with the contents of the array_view "src". More... | |
array (const extent< N > &ext, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Constructs a new array with the supplied extent, located on the accelerator bound to the accelerator_view "av". More... | |
array (const extent< N > &ext, accelerator_view av, void *accelerator_pointer, access_type cpu_access_type=access_type_auto) | |
Constructs an array instance based on the given pointer on the device memory. More... | |
template<typename InputIter > | |
array (const extent< N > &ext, InputIter srcBegin, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Constructs a new array with the supplied extent, located on the accelerator bound to the accelerator_view "av", initialized with the contents of the source container specified by a beginning and optional ending iterator. More... | |
template<typename InputIter > | |
array (const extent< N > &ext, InputIter srcBegin, InputIter srcEnd, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
array (const array_view< const T, N > &src, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Constructs a new array initialized with the contents of the array_view "src". More... | |
array (const extent< N > &ext, accelerator_view av, accelerator_view associated_av) | |
Constructs a staging array with the given extent, which acts as a staging area between accelerator views "av" and "associated_av". More... | |
array (const array_view< const T, N > &src, accelerator_view av, accelerator_view associated_av) | |
Constructs a staging array initialized with the array_view given by "src", which acts as a staging area between accelerator_views "av" (which must be the CPU accelerator) and "associated_av". More... | |
extent< N > | get_extent () const __CPU__ __HC__ |
Access the extent that defines the shape of this array. | |
accelerator_view | get_accelerator_view () const |
This property returns the accelerator_view representing the location where this array has been allocated. | |
accelerator_view | get_associated_accelerator_view () const |
This property returns the accelerator_view representing the preferred target where this array can be copied. | |
access_type | get_cpu_access_type () const |
This property returns the CPU "access_type" allowed for this array. | |
array & | operator= (const array &other) |
Assigns the contents of the array "other" to this array, using a deep copy. More... | |
array & | operator= (array &&other) |
Moves the contents of the array "other" to this array. More... | |
array & | operator= (const array_view< T, N > &src) |
Assigns the contents of the array_view "src", as if by calling "copy(src, *this)". More... | |
void | copy_to (array &dest) const |
Copies the contents of this array to the array given by "dest", as if by calling "copy(*this, dest)". More... | |
void | copy_to (const array_view< T, N > &dest) const |
Copies the contents of this array to the array_view given by "dest", as if by calling "copy(*this, dest)". More... | |
T * | data () const __CPU__ __HC__ |
Returns a pointer to the raw data underlying this array. More... | |
T * | accelerator_pointer () const __CPU__ __HC__ |
Returns a pointer to the device memory underlying this array. More... | |
operator std::vector< T > () const | |
Implicitly converts an array to a std::vector, as if by "copy(*this, vector)". More... | |
const acc_buffer_t & | internal () const __CPU__ __HC__ |
int | get_offset () const __CPU__ __HC__ |
index< N > | get_index_base () const __CPU__ __HC__ |
array (int e0) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]))". More... | |
array (int e0, int e1) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]))". More... | |
array (int e0, int e1, int e2) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]))". More... | |
template<typename InputIter > | |
array (const extent< N > &ext, InputIter srcBegin) | |
Constructs a new array with the supplied extent, located on the default accelerator, initialized with the contents of a source container specified by a beginning and optional ending iterator. More... | |
template<typename InputIter > | |
array (const extent< N > &ext, InputIter srcBegin, InputIter srcEnd) | |
Constructs a new array with the supplied extent, located on the default accelerator, initialized with the contents of a source container specified by a beginning and optional ending iterator. More... | |
template<typename InputIter > | |
array (int e0, InputIter srcBegin) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)". More... | |
template<typename InputIter > | |
array (int e0, InputIter srcBegin, InputIter srcEnd) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)". More... | |
template<typename InputIter > | |
array (int e0, int e1, InputIter srcBegin) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)". More... | |
template<typename InputIter > | |
array (int e0, int e1, InputIter srcBegin, InputIter srcEnd) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)". More... | |
template<typename InputIter > | |
array (int e0, int e1, int e2, InputIter srcBegin) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)". More... | |
template<typename InputIter > | |
array (int e0, int e1, int e2, InputIter srcBegin, InputIter srcEnd) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)". More... | |
array (int e0, void *accelerator_pointer) | |
Constructs an array instance based on the given pointer on the device memory. | |
array (int e0, int e1, void *accelerator_pointer) | |
Constructs an array instance based on the given pointer on the device memory. | |
array (int e0, int e1, int e2, void *accelerator_pointer) | |
Constructs an array instance based on the given pointer on the device memory. | |
array (const extent< N > &ext, void *accelerator_pointer) | |
Constructs an array instance based on the given pointer on the device memory. | |
array (int e0, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, cpu_access_type)". More... | |
array (int e0, int e1, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, cpu_access_type)". More... | |
array (int e0, int e1, int e2, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, cpu_access_type)". More... | |
template<typename InputIter > | |
array (int e0, InputIter srcBegin, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)". More... | |
template<typename InputIter > | |
array (int e0, InputIter srcBegin, InputIter srcEnd, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)". More... | |
template<typename InputIter > | |
array (int e0, int e1, InputIter srcBegin, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)". More... | |
template<typename InputIter > | |
array (int e0, int e1, InputIter srcBegin, InputIter srcEnd, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)". More... | |
template<typename InputIter > | |
array (int e0, int e1, int e2, InputIter srcBegin, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)". More... | |
template<typename InputIter > | |
array (int e0, int e1, int e2, InputIter srcBegin, InputIter srcEnd, accelerator_view av, access_type cpu_access_type=access_type_auto) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)". More... | |
array (int e0, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, associated_av)". More... | |
array (int e0, int e1, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, associated_av)". More... | |
array (int e0, int e1, int e2, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, associated_av)". More... | |
template<typename InputIter > | |
array (const extent< N > &ext, InputIter srcBegin, accelerator_view av, accelerator_view associated_av) | |
Constructs a staging array with the given extent, which acts as a staging area between accelerator_views "av" (which must be the CPU accelerator) and "associated_av". More... | |
template<typename InputIter > | |
array (const extent< N > &ext, InputIter srcBegin, InputIter srcEnd, accelerator_view av, accelerator_view associated_av) | |
Constructs a staging array with the given extent, which acts as a staging area between accelerator_views "av" (which must be the CPU accelerator) and "associated_av". More... | |
template<typename InputIter > | |
array (int e0, InputIter srcBegin, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)". More... | |
template<typename InputIter > | |
array (int e0, InputIter srcBegin, InputIter srcEnd, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)". More... | |
template<typename InputIter > | |
array (int e0, int e1, InputIter srcBegin, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)". More... | |
template<typename InputIter > | |
array (int e0, int e1, InputIter srcBegin, InputIter srcEnd, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)". More... | |
template<typename InputIter > | |
array (int e0, int e1, int e2, InputIter srcBegin, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)". More... | |
template<typename InputIter > | |
array (int e0, int e1, int e2, InputIter srcBegin, InputIter srcEnd, accelerator_view av, accelerator_view associated_av) | |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)". More... | |
T & | operator[] (const index< N > &idx) __CPU__ __HC__ |
Returns a reference to the element of this array that is at the location in N-dimensional space specified by "idx". More... | |
T & | operator() (const index< N > &idx) __CPU__ __HC__ |
Returns a reference to the element of this array that is at the location in N-dimensional space specified by "idx". More... | |
const T & | operator[] (const index< N > &idx) const __CPU__ __HC__ |
Returns a const reference to the element of this array that is at the location in N-dimensional space specified by "idx". More... | |
const T & | operator() (const index< N > &idx) const __CPU__ __HC__ |
Returns a const reference to the element of this array that is at the location in N-dimensional space specified by "idx". More... | |
T & | operator() (int i0, int i1) __CPU__ __HC__ |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]]))". More... | |
T & | operator() (int i0, int i1, int i2) __CPU__ __HC__ |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]]))". More... | |
const T & | operator() (int i0, int i1) const __CPU__ __HC__ |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const". More... | |
const T & | operator() (int i0, int i1, int i2) const __CPU__ __HC__ |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const". More... | |
array_projection_helper< T, N >::result_type | operator[] (int i) __CPU__ __HC__ |
This overload is defined for array<T,N> where . More... | |
array_projection_helper< T, N >::result_type | operator() (int i0) __CPU__ __HC__ |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const". More... | |
array_projection_helper< T, N >::const_result_type | operator[] (int i) const __CPU__ __HC__ |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const". More... | |
array_projection_helper< T, N >::const_result_type | operator() (int i0) const __CPU__ __HC__ |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const". More... | |
array_view< T, N > | section (const index< N > &origin, const extent< N > &ext) __CPU__ __HC__ |
Returns a subsection of the source array view at the origin specified by "idx" and with the extent specified by "ext". More... | |
array_view< const T, N > | section (const index< N > &origin, const extent< N > &ext) const __CPU__ __HC__ |
Returns a subsection of the source array view at the origin specified by "idx" and with the extent specified by "ext". More... | |
array_view< T, N > | section (const index< N > &idx) __CPU__ __HC__ |
Equivalent to "section(idx, this->extent – idx)". | |
array_view< const T, N > | section (const index< N > &idx) const __CPU__ __HC__ |
Equivalent to "section(idx, this->extent – idx)". | |
array_view< T, N > | section (const extent< N > &ext) __CPU__ __HC__ |
Equivalent to "section(index<N>(), ext)". | |
array_view< const T, N > | section (const extent< N > &ext) const __CPU__ __HC__ |
Equivalent to "section(index<N>(), ext)". | |
array_view< T, 1 > | section (int i0, int e0) __CPU__ __HC__ |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const". More... | |
array_view< const T, 1 > | section (int i0, int e0) const __CPU__ __HC__ |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const". More... | |
array_view< T, 2 > | section (int i0, int i1, int e0, int e1) const __CPU__ __HC__ |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const". More... | |
array_view< T, 2 > | section (int i0, int i1, int e0, int e1) __CPU__ __HC__ |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const". More... | |
array_view< T, 3 > | section (int i0, int i1, int i2, int e0, int e1, int e2) __CPU__ __HC__ |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const". More... | |
array_view< const T, 3 > | section (int i0, int i1, int i2, int e0, int e1, int e2) const __CPU__ __HC__ |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const". More... | |
template<typename ElementType > | |
array_view< ElementType, 1 > | reinterpret_as () __CPU__ __HC__ |
Sometimes it is desirable to view the data of an N-dimensional array as a linear array, possibly with a (unsafe) reinterpretation of the element type. More... | |
template<typename ElementType > | |
array_view< const ElementType, 1 > | reinterpret_as () const __CPU__ __HC__ |
Sometimes it is desirable to view the data of an N-dimensional array as a linear array, possibly with a (unsafe) reinterpretation of the element type. More... | |
template<int K> | |
array_view< T, K > | view_as (const extent< K > &viewExtent) __CPU__ __HC__ |
An array of higher rank can be reshaped into an array of lower rank, or vice versa, using the view_as member function. More... | |
template<int K> | |
array_view< const T, K > | view_as (const extent< K > &viewExtent) const __CPU__ __HC__ |
An array of higher rank can be reshaped into an array of lower rank, or vice versa, using the view_as member function. More... | |
Static Public Attributes | |
static const int | rank = N |
The rank of this array. | |
Friends | |
template<typename K , int Q> | |
struct | projection_helper |
template<typename K , int Q> | |
struct | array_projection_helper |
template<typename Q , int K> | |
void | copy (const array< Q, K > &, const array_view< Q, K > &) |
template<typename Q , int K> | |
void | copy (const array_view< const Q, K > &, array< Q, K > &) |
Represents an N-dimensional region of memory (with type T) located on an accelerator.
T | The element type of this array |
N | The dimensionality of the array, defaults to 1 if elided. |
Copy constructor.
Constructs a new array<T,N> from the supplied argument other. The new array is located on the same accelerator_view as the source array. A deep copy is performed.
[in] | other | An object of type array<T,N> from which to initialize this new array. |
References hc::copy().
Move constructor.
Constructs a new array<T,N> by moving from the supplied argument other.
[in] | other | An object of type array<T,N> from which to initialize this new array. |
Constructs a new array with the supplied extent, located on the default view of the default accelerator.
If any components of the extent are non-positive, an exception will be thrown.
[in] | ext | The extent in each dimension of this array. |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]))".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]))".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]))".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
|
inline |
Constructs a new array with the supplied extent, located on the default accelerator, initialized with the contents of a source container specified by a beginning and optional ending iterator.
The source data is copied by value into this array as if by calling "copy()".
If the number of available container elements is less than this->extent.size(), undefined behavior results.
[in] | ext | The extent in each dimension of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
|
inline |
Constructs a new array with the supplied extent, located on the default accelerator, initialized with the contents of a source container specified by a beginning and optional ending iterator.
The source data is copied by value into this array as if by calling "copy()".
If the number of available container elements is less than this->extent.size(), undefined behavior results.
[in] | ext | The extent in each dimension of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
|
inlineexplicit |
Constructs a new array, located on the default view of the default accelerator, initialized with the contents of the array_view "src".
The extent of this array is taken from the extent of the source array_view. The "src" is copied by value into this array as if by calling "copy(src, *this)".
[in] | src | An array_view object from which to copy the data into this array (and also to determine the extent of this array). |
References hc::copy().
|
inline |
Constructs a new array with the supplied extent, located on the accelerator bound to the accelerator_view "av".
Users can optionally specify the type of CPU access desired for "this" array thus requesting creation of an array that is accessible both on the specified accelerator_view "av" as well as the CPU (with the specified CPU access_type). If a value other than access_type_auto or access_type_none is specified for the cpu_access_type parameter and the accelerator corresponding to the accelerator_view "av" does not support cpu_shared_memory, a runtime_exception is thrown. The cpu_access_type parameter has a default value of access_type_auto which leaves it up to the implementation to decide what type of allowed CPU access should the array be created with. The actual CPU access_type allowed for the created array can be queried using the get_cpu_access_type member method.
[in] | ext | The extent in each dimension of this array. |
[in] | av | An accelerator_view object which specifies the location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inlineexplicit |
Constructs an array instance based on the given pointer on the device memory.
[in] | ext | The extent in each dimension of this array. |
[in] | av | An accelerator_view object which specifies the location of this array. |
[in] | accelerator_pointer | The pointer to the device memory. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | av | An accelerator_view object which specifies the location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | av | An accelerator_view object which specifies the location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | av | An accelerator_view object which specifies the location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Constructs a new array with the supplied extent, located on the accelerator bound to the accelerator_view "av", initialized with the contents of the source container specified by a beginning and optional ending iterator.
The data is copied by value into this array as if by calling "copy()".
Users can optionally specify the type of CPU access desired for "this" array thus requesting creation of an array that is accessible both on the specified accelerator_view "av" as well as the CPU (with the specified CPU access_type). If a value other than access_type_auto or access_type_none is specified for the cpu_access_type parameter and the accelerator corresponding to the accelerator_view "av" does not support cpu_shared_memory, a runtime_exception is thrown. The cpu_access_type parameter has a default value of access_type_auto which leaves it upto the implementation to decide what type of allowed CPU access should the array be created with. The actual CPU access_type allowed for the created array can be queried using the get_cpu_access_type member method.
[in] | ext | The extent in each dimension of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
References hc::copy(), and hc::extent< N >::size().
|
inline |
Constructs a new array initialized with the contents of the array_view "src".
The extent of this array is taken from the extent of the source array_view. The "src" is copied by value into this array as if by calling "copy(src, *this)". The new array is located on the accelerator bound to the accelerator_view "av".
Users can optionally specify the type of CPU access desired for "this" array thus requesting creation of an array that is accessible both on the specified accelerator_view "av" as well as the CPU (with the specified CPU access_type). If a value other than access_type_auto or access_type_none is specified for the cpu_access_type parameter and the accelerator corresponding to the accelerator_view “av” does not support cpu_shared_memory, a runtime_exception is thrown. The cpu_access_type parameter has a default value of access_type_auto which leaves it upto the implementation to decide what type of allowed CPU access should the array be created with. The actual CPU access_type allowed for the created array can be queried using the get_cpu_access_type member method.
[in] | src | An array_view object from which to copy the data into this array (and also to determine the extent of this array). |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
References hc::copy().
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), srcBegin [, srcEnd], av, cpu_access_type)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | access_type | The type of CPU access desired for this array. |
|
inline |
Constructs a staging array with the given extent, which acts as a staging area between accelerator views "av" and "associated_av".
If "av" is a cpu accelerator view, this will construct a staging array which is optimized for data transfers between the CPU and "associated_av".
[in] | ext | The extent in each dimension of this array. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Constructs a staging array with the given extent, which acts as a staging area between accelerator_views "av" (which must be the CPU accelerator) and "associated_av".
The staging array will be initialized with the data specified by "src" as if by calling "copy(src, *this)".
[in] | ext | The extent in each dimension of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
References hc::copy().
|
inline |
Constructs a staging array with the given extent, which acts as a staging area between accelerator_views "av" (which must be the CPU accelerator) and "associated_av".
The staging array will be initialized with the data specified by "src" as if by calling "copy(src, *this)".
[in] | ext | The extent in each dimension of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
References hc::copy(), and hc::extent< N >::size().
|
inline |
Constructs a staging array initialized with the array_view given by "src", which acts as a staging area between accelerator_views "av" (which must be the CPU accelerator) and "associated_av".
The extent of this array is taken from the extent of the source array_view. The staging array will be initialized from "src" as if by calling "copy(src, *this)".
[in] | src | An array_view object from which to copy the data into this array (and also to determine the extent of this array). |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
References hc::copy().
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Equivalent to construction using "array(extent<N>(e0 [, e1 [, e2 ]]), src, av, associated_av)".
[in] | e0,e1,e2 | The component values that will form the extent of this array. |
[in] | srcBegin | A beginning iterator into the source container. |
[in] | srcEnd | An ending iterator into the source container. |
[in] | av | An accelerator_view object which specifies the home location of this array. |
[in] | associated_av | An accelerator_view object which specifies a target device accelerator. |
|
inline |
Returns a pointer to the device memory underlying this array.
|
inline |
Copies the contents of this array to the array given by "dest", as if by calling "copy(*this, dest)".
[out] | dest | An object of type array<T,N> to which to copy data from this array. |
References hc::copy().
|
inline |
Copies the contents of this array to the array_view given by "dest", as if by calling "copy(*this, dest)".
[out] | dest | An object of type array_view<T,N> to which to copy data from this array. |
References hc::copy().
|
inline |
Returns a pointer to the raw data underlying this array.
|
inline |
Implicitly converts an array to a std::vector, as if by "copy(*this, vector)".
References hc::copy(), and hc::extent< N >::size().
Returns a reference to the element of this array that is at the location in N-dimensional space specified by "idx".
Accessing array data on a location where it is not resident (e.g. from the CPU when it is resident on a GPU) results in an exception (in cpu context) or undefined behavior (in GPU context).
[in] | idx | An object of type index<N> from that specifies the location of the element. |
|
inline |
Returns a const reference to the element of this array that is at the location in N-dimensional space specified by "idx".
Accessing array data on a location where it is not resident (e.g. from the CPU when it is resident on a GPU) results in an exception (in cpu context) or undefined behavior (in GPU context).
[in] | idx | An object of type index<N> from that specifies the location of the element. |
|
inline |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]]))".
[in] | i0,i1,i2 | The component values that will form the index into this array. |
|
inline |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]]))".
[in] | i0,i1,i2 | The component values that will form the index into this array. |
|
inline |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the index into this array. |
|
inline |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the index into this array. |
|
inline |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the index into this array. |
|
inline |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the index into this array. |
|
inline |
Assigns the contents of the array "other" to this array, using a deep copy.
[in] | other | An object of type array<T,N> from which to copy into this array. |
|
inline |
Moves the contents of the array "other" to this array.
[in] | other | An object of type array<T,N> from which to move into this array. |
References hc::extent< N >::extent().
|
inline |
Assigns the contents of the array_view "src", as if by calling "copy(src, *this)".
[in] | src | An object of type array_view<T,N> from which to copy into this array. |
Returns a reference to the element of this array that is at the location in N-dimensional space specified by "idx".
Accessing array data on a location where it is not resident (e.g. from the CPU when it is resident on a GPU) results in an exception (in cpu context) or undefined behavior (in GPU context).
[in] | idx | An object of type index<N> from that specifies the location of the element. |
|
inline |
Returns a const reference to the element of this array that is at the location in N-dimensional space specified by "idx".
Accessing array data on a location where it is not resident (e.g. from the CPU when it is resident on a GPU) results in an exception (in cpu context) or undefined behavior (in GPU context).
[in] | idx | An object of type index<N> from that specifies the location of the element. |
|
inline |
This overload is defined for array<T,N> where .
This mode of indexing is equivalent to projecting on the most-significant dimension. It allows C-style indexing. For example:
i0 | An integer that is the index into the most-significant dimension of this array. |
|
inline |
Equivalent to "array<T,N>::operator()(index<N>(i0 [, i1 [, i2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the index into this array. |
|
inline |
Sometimes it is desirable to view the data of an N-dimensional array as a linear array, possibly with a (unsafe) reinterpretation of the element type.
This can be achieved through the reinterpret_as member function. Example:
The size of the reinterpreted ElementType must evenly divide into the total size of this array.
References hc::extent< N >::size().
|
inline |
Sometimes it is desirable to view the data of an N-dimensional array as a linear array, possibly with a (unsafe) reinterpretation of the element type.
This can be achieved through the reinterpret_as member function. Example:
The size of the reinterpreted ElementType must evenly divide into the total size of this array.
References hc::extent< N >::size().
|
inline |
Returns a subsection of the source array view at the origin specified by "idx" and with the extent specified by "ext".
Example:
[in] | origin | Provides the offset/origin of the resulting section. |
[in] | ext | Provides the extent of the resulting section. |
References hc::array_view< T, N >::section().
|
inline |
Returns a subsection of the source array view at the origin specified by "idx" and with the extent specified by "ext".
Example:
[in] | origin | Provides the offset/origin of the resulting section. |
[in] | ext | Provides the extent of the resulting section. |
References hc::array_view< const T, N >::section().
|
inline |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the origin of the section |
[in] | e0,e1,e2 | The component values that will form the extent of the section |
|
inline |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the origin of the section |
[in] | e0,e1,e2 | The component values that will form the extent of the section |
|
inline |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the origin of the section |
[in] | e0,e1,e2 | The component values that will form the extent of the section |
|
inline |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the origin of the section |
[in] | e0,e1,e2 | The component values that will form the extent of the section |
|
inline |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the origin of the section |
[in] | e0,e1,e2 | The component values that will form the extent of the section |
|
inline |
Equivalent to "array<T,N>::section(index<N>(i0 [, i1 [, i2 ]]), extent<N>(e0 [, e1 [, e2 ]])) const".
[in] | i0,i1,i2 | The component values that will form the origin of the section |
[in] | e0,e1,e2 | The component values that will form the extent of the section |
|
inline |
An array of higher rank can be reshaped into an array of lower rank, or vice versa, using the view_as member function.
Example:
References hc::extent< N >::size().
|
inline |
An array of higher rank can be reshaped into an array of lower rank, or vice versa, using the view_as member function.
Example:
References hc::copy(), and hc::extent< N >::size().