- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int* p1[10];
int* p2[10];
int start[10];
int len[10];
for(int i=0;i<10;i++)
{
p1=new int[(i+1)*1000];
p2=new int[(i+1)*1000];
len=(i+1)*1000;
start=0;
}
/*
#pragma offload target(mic)\
nocopy(p1[0:10]:\
extent(start[0:10]:len[0:10]) alloc_if(1) free_if(0))\
nocopy(p2[0:10]:\
extent(start[0:10]:len[0:10]) alloc_if(1) free_if(0))
{
;
}
*/
printf("init \n");
int count=0;
while(true)
{
#pragma offload target(mic)\
in(p1[0:10]:\
extent(start[0:10]:len[0:10]) alloc_if(1) free_if(1))\
out(p2[0:10]:\
extent(start[0:10]:len[0:10]) alloc_if(1) free_if(1))
{
for(int i=0;i<10;i++)
{
memcpy(p2,p1,(i+1)*1000*sizeof(int));
}
}
printf("%d\n",count++);
}
return 0;
}
I try to offload 2-D Array and copy the memory.But it crash at
memcpy(p2,p1,(i+1)*1000*sizeof(int));
I have no idea why it crash.
By the way,In another program ,some times the program will stuck at a very simple offload statement and it seems to sleep forever.
Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page