parallel_for_each(av.extent, [=](concurrency::index<1>idx)restrict(amp) {av[idx] += 1; });
//[=](concurrency::index<1>idx操作每一个元素
//restrict(amp)定位GPU执行
#include <iostream>
#include <amp.h> void main()
{
int a[] = { ,,,,,,,,, }; concurrency::array_view<int>av(, a);//GPU计算结构,av存储到GPU显存 parallel_for_each(av.extent, [=](concurrency::index<>idx)restrict(amp) {av[idx] += ; });
//[=](concurrency::index<1>idx操作每一个元素
//restrict(amp)定位GPU执行 for (int i = ; i < ; i++)
{
std::cout << av[i] << std::endl;
}
}