C ++ AMP in Visual Studio 2015: compiler / runtime error or error?

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];

    // Create C++ AMP objects.
    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(
        // Define the compute domain, which is the set of threads that are created.
        sum.extent,
        // Define the code to run on each thread on the accelerator.
        [=](index<1> idx) restrict(amp)
    {
        sum[idx] = a[idx] + b[idx];
    }
    );

    // Print the results. The expected output is "7, 9, 11, 13, 15".
    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 .., . !

+4
3

GPU.

:

enter image description here

+2

, :

", ++ AMP .., ."

, DirectX11.

, . Windows 8 , , , , . , GPU .

+1

, debug ( ), , , - ( ) Visual studio, 3 build 2015, . , , , ...

0
source

Source: https://habr.com/ru/post/1607193/


All Articles