Software Archive
Read-only legacy content
17061 Discussions

offload error: cannot create buffer on device 0 (error code 16)

kevin_h_
Beginner
256 Views

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.

0 Kudos
0 Replies
Reply