V
V
Vasily2016-02-02 01:52:15
C++ / C#
Vasily, 2016-02-02 01:52:15

How to resolve left of ".data" error?

Compiler program visual studio community 2015.
Program text:

#include <iostream>
#include <iomanip>
#include <type_traits>
using namespace std;
#include <amp.h>
using namespace concurrency;

const size_t demianiuk = 3, demianiuk1 = 3;

void add_in_amp()
{
    int A[2][3] = { { 23, 24, 25 } , { 26, 27, 28 } };
    int B[2][3] = { { 29, 30, 31 }, { 32, 33, 34 } };
    int C[demianiuk][demianiuk1] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };

    //array_view<const int, 1> ad(item_count, ah);
    //array_view<const int, 1> bd(item_count, bh);
    //array_view<int, 1> sumd(item_count, sumh);
    array_view<int, 2> ad(2, 3, A);
    array_view<int, 2> bd(3, 2, B);
    array_view<int, 2> sumd(3, 3, C);
    array_view<int, 2> a(sumd);

    sumd.discard_data();

    parallel_for_each(a.extent, [ = ](index<2> idx)restrict(amp)
    {
        /*int a = ad[idx];
        int b = bd[idx];
        sumd[idx] = a + b;*/
        int row = idx[0];
        int col = idx[1];
        for (int inner = 0; inner < 2; inner++)
        {
            sumd[idx] += ad(row, inner) * bd(inner, col);
        }

    });

    sumd.synchronize();

    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            printf("%3d", C[i][j]);
        }
        printf("\n");
    }
    printf("\n");
}


int main()
{
    add_in_amp();
    getchar();
    return 0;
}

I know that the error is in a.extent, but according to the MSDN examples, everything seems to be fine, however, I get an error:
77534ce389264a68a35194ba48fc3abd.jpg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question