mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-05 08:51:48 +00:00
44 lines
468 B
C++
44 lines
468 B
C++
|
#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;
|
||
|
}
|