- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,I am new to Xeon Phi coproccessors and I am trying to adapt a program previously made for only CPU to offload to the Xeon Phi. Now I just try to modify the program and transfer a buffer to MIC. The code is presented below.
for (i=1; i<=n; i++) {
//computation
…
int Length = 9996;
printf("%d\n", Length);
int * tmp_buf = NULL;
tmp_buf = (int *)malloc(Length * sizeof(int) );
if(tmp_buf == NULL)
printf("ERROR\n");
#pragma offload target(mic:0) in(tmp_buf: length(Length) alloc_if(1) free_if(1))
{
}
free(tmp_buf);
…
//computation
}
If I use malloc() to create a buffer and transfer it to the MIC, sometime I may meet the problem offload error: cannot create buffer on device 0 (error code 16). But if I use static array, the problem disappears. I'm wondering if anyone has experienced and successfully overcame this problem.
Thanks.
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