array Class
Represents a data container used to move data to an accelerator.
template <
typename _Value_type,
int _Rank
>
friend class array;
Parameters
_Value_type
The element type of the data._Rank
The rank of the array.
Members
Public Constructors
Name |
Description |
---|---|
Initializes a new instance of the array class. |
|
Destroys the array object. |
Public Methods
Name |
Description |
---|---|
Copies the contents of the array to another array. |
|
Returns a pointer to the raw data of the array. |
|
Returns the accelerator_view object that represents the location where the array is allocated. This property can be accessed only on the CPU. |
|
Gets the second accelerator_view object that is passed as a parameter when a staging constructor is called to instantiate the array object. |
|
Returns the access_type of the array. This method can be accessed only on the CPU. |
|
Returns the extent object of the array. |
|
Returns a one-dimensional array that contains all the elements in the array object. |
|
Returns a subsection of the array object that is at the specified origin and, optionally, that has the specified extent. |
|
Returns an array_view object that is constructed from the array object. |
Public Operators
Name |
Description |
---|---|
Uses copy(*this, vector) to implicitly convert the array to a std::vector object. |
|
Returns the element value that is specified by the parameters. |
|
Returns the element that is at the specified index. |
|
Copies the contents of the specified array object into this one. |
Public Constants
Name |
Description |
---|---|
Stores the rank of the array. |
Public Data Members
Name |
Description |
---|---|
Gets the accelerator_view object that represents the location where the array is allocated. This property can be accessed only on the CPU. |
|
Gets the second accelerator_view object that is passed as a parameter when a staging constructor is called to instantiate the array object. |
|
Gets the access_type that represents how the CPU can access the storage of the array. |
|
Gets the extent that defines the shape of the array. |
Remarks
The type array<T,N> represents a dense and regular (not jagged) N-dimensional array that is located in a specific location, such as an accelerator or the CPU. The data type of the elements in the array is T, which must be of a type that is compatible with the target accelerator. Although the rank, N, (of the array is determined statically and is part of the type, the extent of the array is determined by the runtime and is expressed by using class extent<N>.
An array can have any number of dimensions, although some functionality is specialized for array objects with rank one, two, and three. If you omit the dimension argument, the default is 1.
Array data is laid out contiguously in memory. Elements that differ by one in the least significant dimension are adjacent in memory.
Arrays are logically considered to be value types, because when an array is copied to another array, a deep copy is performed. Two arrays never point to the same data.
The array<T,N> type is used in several scenarios:
As a data container that can be used in computations on an accelerator.
As a data container to hold memory on the host CPU (that can be used to copy to and from other arrays).
As a staging object to act as a fast intermediary in host-to-device copies.
Inheritance Hierarchy
array
Requirements
Header: amp.h
Namespace: Concurrency