Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Data is copied between the CPU and the accelerator (usually a GPU) either automatically or with one of the many overloads of the copy() method provided in amp.h. For example, you can construct an array on the default accelerator and copy data to it in a single call:
array<int, 1> a(5, v.begin(), v.end());
Alternatively, you can construct an empty array and later use the copy() function to fill it with data. An array_view associated with a container on the CPU will automatically copy to the accelerator when the processing of that array_view on the accelerator begins, and it can synchronize changed data back for use on the CPU, as shown in the array_view section earlier in this chapter.
These blocks of code are equivalent: