<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic offload error: cannot create buffer on device 0 (error code 16) in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/offload-error-cannot-create-buffer-on-device-0-error-code-16/m-p/1099213#M68018</link>
    <description>&lt;P&gt;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&amp;nbsp;program and transfer a buffer to MIC. The code is presented below.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;for (i=1; i&amp;lt;=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
}
&lt;/PRE&gt;

&lt;P&gt;If I use malloc() to create a buffer and transfer it to the MIC, sometime I may meet the problem &lt;EM&gt;offload error: cannot create buffer on device 0 (error code 16)&lt;/EM&gt;. But if I use static array, the problem disappears. I'm wondering if anyone has experienced and successfully overcame this problem.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2016 03:15:37 GMT</pubDate>
    <dc:creator>kevin_h_</dc:creator>
    <dc:date>2016-11-29T03:15:37Z</dc:date>
    <item>
      <title>offload error: cannot create buffer on device 0 (error code 16)</title>
      <link>https://community.intel.com/t5/Software-Archive/offload-error-cannot-create-buffer-on-device-0-error-code-16/m-p/1099213#M68018</link>
      <description>&lt;P&gt;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&amp;nbsp;program and transfer a buffer to MIC. The code is presented below.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;for (i=1; i&amp;lt;=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
}
&lt;/PRE&gt;

&lt;P&gt;If I use malloc() to create a buffer and transfer it to the MIC, sometime I may meet the problem &lt;EM&gt;offload error: cannot create buffer on device 0 (error code 16)&lt;/EM&gt;. But if I use static array, the problem disappears. I'm wondering if anyone has experienced and successfully overcame this problem.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 03:15:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/offload-error-cannot-create-buffer-on-device-0-error-code-16/m-p/1099213#M68018</guid>
      <dc:creator>kevin_h_</dc:creator>
      <dc:date>2016-11-29T03:15:37Z</dc:date>
    </item>
  </channel>
</rss>

