I would like to try the following C ++ AMP code example from the Microsoft documentation:
(The second example code is at https://msdn.microsoft.com/en-us/library/hh265136.aspx , slightly adapted to turn it into a program):
#include "stdafx.h"
#include <amp.h>
#include <iostream>
using namespace concurrency;
const int size = 5;
void CppAmpMethod() {
int aCPP[] = { 1, 2, 3, 4, 5 };
int bCPP[] = { 6, 7, 8, 9, 10 };
int sumCPP[size];
array_view<const int, 1> a(size, aCPP);
array_view<const int, 1> b(size, bCPP);
array_view<int, 1> sum(size, sumCPP);
sum.discard_data();
parallel_for_each(
sum.extent,
[=](index<1> idx) restrict(amp)
{
sum[idx] = a[idx] + b[idx];
}
);
for (int i = 0; i < size; i++) {
std::cout << sum[i] << "\n";
}
}
int main()
{
CppAmpMethod();
return 0;
}
Unfortunately, when it is compiled (using Visual Studio 2015) and it is executed, this throws an exception at runtime in the first of the array_view constructs.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nvwgf2um.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. Cannot find or open the PDB file.
Exception thrown at 0x0F9CC933 (vcamp140d.dll) in ConsoleApplication2.exe: 0xC0000005: Access violation reading location 0xCDCDCDCD.
, . , ? , - , ++ AMP .., . !