Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lisanhu
Created February 24, 2020 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lisanhu/c48ba0a0aa2d971f8c1667782b8808f9 to your computer and use it in GitHub Desktop.
Save lisanhu/c48ba0a0aa2d971f8c1667782b8808f9 to your computer and use it in GitHub Desktop.
Deepcopy Sample code in Cpp
typedef struct Outer {
int *data, w, h;
#pragma acc policy<dpmove> copy(data[:w])
// Outer(int *data = nullptr, int w = 0, int h = 0): data(data) {}
} Outer;
Outer init_outer(int *data, int w, int h) {
Outer r = {data, w, h};
return r;
}
int main(int argc, char const *argv[]) {
int data[32 * 3];
// int * data = nullptr;
// Outer one = Outer(data, 32, 3);
Outer one = init_outer(data, 32, 3);
#pragma acc data copy(one<dpmove>)
{
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment