blob: 510c690cf871baa5354aad7f7cd4e3ee452ba12b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include <cstdlib>
#include <iostream>
using namespace std;
class test {
public:
int a;
test ()
{
a = -1;
#pragma acc enter data copyin (this[0:1])
}
~test ()
{
#pragma acc exit data delete (this[0:1])
}
void set (int i)
{
a = i;
#pragma acc update device (this[0:1])
}
int get ()
{
#pragma acc update host (this[0:1])
return a;
}
};
int
main ()
{
test t;
t.set (4);
if (t.get () != 4)
abort ();
return 0;
}
|