Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Represents an N-dimensional view over the data held in another container.
template <
typename _Value_type,
int _Rank = 1
>
class array_view : public _Array_view_base<_Rank, sizeof(_Value_type)/sizeof(int)>;
template <
typename _Value_type,
int _Rank
>
class array_view<const _Value_type, _Rank> : public _Array_view_base<_Rank, sizeof(_Value_type)/sizeof(int)>;
Parameters
_Value_type
The data type of the elements in the array_view object._Rank
The rank of the array_view object.
Members
Public Constructors
Name |
Description |
---|---|
Initializes a new instance of the array_view class. There is no default constructor for array<T,N>. All constructors are restricted to run on the CPU only and cannot be executed on a Direct3D target. |
|
Destroys the array_view object. |
Public Methods
Name |
Description |
---|---|
Copies the contents of the array_view object to the specified destination by calling copy(*this, dest). |
|
Returns a pointer to the raw data of the array_view. |
|
Discards the current data underlying this view. |
|
Returns the extent object of the array_view object. |
|
Returns a reference to the indexed element. |
|
Returns the accelerator_view where the data source of the array_view is located. |
|
Notifies the array_view object that its bound memory has been modified outside the array_view interface. A call to this method renders all cached information stale. |
|
Returns a one-dimensional array that contains all the elements in the array_view object. |
|
Returns a subsection of the array_view object that's at the specified origin and, optionally, that has the specified extent. |
|
Synchronizes any modifications made to the array_view object back to its source data. |
|
Asynchronously synchronizes any modifications made to the array_view object back to its source data. |
|
Synchronizes any modifications made to the array_view object to the specified accelerator_view. |
|
Asynchronously synchronizes any modifications made to the array_view object to the specified accelerator_view. |
|
Produces an array_view object of a different rank using this array_view object’s data. |
Public Operators
Name |
Description |
---|---|
Returns the value of the element that is specified by the parameter or parameters. |
|
Returns the element that is specified by the parameters. |
|
Copies the contents of the specified array_view object into this one. |
Public Constants
Name |
Description |
---|---|
Stores the rank of the array_view object. |
Data Members
Name |
Description |
---|---|
Gets the extent object that defines the shape of the array_view object. |
|
Gets the accelerator_view where the data source of the array_view is located |
|
The value type of the array_view and the bound array. |
Remarks
The array_view class represents a view into the data that is contained in an array object or a subsection of an array object.
You can access the array_view object where the source data is located (locally) or on a different accelerator or a coherence ___domain (remotely). When you access the object remotely, views are copied and cached as necessary. Except for the effects of automatic caching, array_view objects have a performance profile similar to that of array objects. There is a small performance penalty when you access the data through views.
There are three remote usage scenarios:
A view to a system memory pointer is passed by means of a parallel_for_each call to an accelerator and accessed on the accelerator.
A view to an array located on an accelerator is passed by means of a parallel_for_each call to another accelerator and is accessed there.
A view to an array located on an accelerator is accessed on the CPU.
In any one of these scenarios, the referenced views are copied by the runtime to the remote ___location and, if modified by the calls to the array_view object, are copied back to the local ___location. The runtime might optimize the process of copying changes back, might copy only changed elements, or might copy unchanged portions also. Overlapping array_view objects on one data source are not guaranteed to maintain referential integrity in a remote ___location.
You must synchronize any multithreaded access to the same data source.
The runtime makes the following guarantees regarding the caching of data in array_view objects:
All well-synchronized accesses to an array object and an array_view object on it in program order obey a serial happens-before relationship.
All well-synchronized accesses to overlapping array_view objects on the same accelerator on a single array object are aliased through the array object. They induce a total occurs-before relationship which obeys program order. There is no caching. If the array_view objects are executing on different accelerators, the order of access is undefined, creating a race condition.
When you create an array_view object using a pointer in system memory, you must change the view array_view object only through the array_view pointer. Alternatively, you must call refresh() on one of the array_view objects that are attached to the system pointer, if the underlying native memory is changed directly, instead of through the array_view object.
Either action notifies the array_view object that the underlying native memory is changed and that any copies that are located on an accelerator are outdated. If you follow these guidelines, the pointer-based views are identical to those provided to views of data-parallel arrays.
Inheritance Hierarchy
_Array_view_shape
_Array_view_base
array_view
Requirements
Header: amp.h
Namespace: Concurrency