感觉AMP代码很好懂
一、vc++11代码
#include <amp.h>
3:
namespace concurrency;
5:
int n)
7: {
// Create a view over the data on the CPU
float,1> dataView(n, &arr[0]);
10:
// Run code on the GPU
12: parallel_for_each(dataView.extent, [=] (index<1> idx) restrict(amp)
13: {
14: dataView[idx] = dataView[idx] * dataView[idx];
15: });
16:
// Copy data from GPU to CPU
18: dataView.synchronize();
19: }